diff options
author | Paul Jones <28073230+paulmj7@users.noreply.github.com> | 2020-08-25 06:33:38 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-25 12:33:38 +0200 |
commit | 54d336ab20e19664dc2bfa4218f09f8713a06244 (patch) | |
tree | c1c85f9e419a5ba56d7f7879be9ee7ba951bbdfa | |
parent | c4d5b01acfe0cac31f94743a57e8e619178ba563 (diff) |
docs(std/fs): provide more context on unstable perm (#6748)
-rw-r--r-- | std/fs/README.md | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/std/fs/README.md b/std/fs/README.md index 0b71b2b9d..1287df489 100644 --- a/std/fs/README.md +++ b/std/fs/README.md @@ -4,8 +4,8 @@ fs module is made to provide helpers to manipulate the filesystem. ## Usage -All the following modules are exposed in `mod.ts` This feature is currently -unstable. To enable it use `deno run --unstable` +Most the following modules are exposed in `mod.ts` This feature is currently +<b>unstable</b>. To enable it use `deno run --unstable` ### emptyDir @@ -174,6 +174,37 @@ async function printFilesNames() { printFilesNames().then(() => console.log("Done!")); ``` +### readFileStr + +Read file and output it as a string. Note: this module does not require the +`--unstable` flag. + +**ReadOptions** + +- encoding : The encoding to read file. lowercased. + +```ts +import { readFileStr, readFileStrSync } from "https://deno.land/std/fs/mod.ts"; + +readFileStr("./target.dat", { encoding: "utf8" }); // returns a promise +readFileStrSync("./target.dat", { encoding: "utf8" }); // string +``` + +### writeFileStr + +Write the string to file. Note: this module does not require the `--unstable` +flag. + +```ts +import { + writeFileStr, + writeFileStrSync, +} from "https://deno.land/std/fs/mod.ts"; + +writeFileStr("./target.dat", "file content"); // returns a promise +writeFileStrSync("./target.dat", "file content"); // void +``` + ### expandGlob Expand the glob string from the specified `root` directory and yield each result |