summaryrefslogtreecommitdiff
path: root/std/fs/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'std/fs/README.md')
-rw-r--r--std/fs/README.md8
1 files changed, 7 insertions, 1 deletions
diff --git a/std/fs/README.md b/std/fs/README.md
index aad81acee..0b71b2b9d 100644
--- a/std/fs/README.md
+++ b/std/fs/README.md
@@ -133,18 +133,24 @@ const foo = readJsonSync("./foo.json");
Writes an object to a JSON file.
-**WriteJsonOptions**
+#### WriteJsonOptions
- replacer : An array of strings and numbers that acts as a approved list for
selecting the object properties that will be stringified.
- space : Adds indentation, white space, and line break characters to the
return-value JSON text to make it easier to read.
+You can also specify options from `Deno.WriteFileOptions` to configure how the
+file is written.
+
```ts
import { writeJson, writeJsonSync } from "https://deno.land/std/fs/mod.ts";
writeJson("./target.dat", { foo: "bar" }, { spaces: 2 }); // returns a promise
writeJsonSync("./target.dat", { foo: "bar" }, { replacer: ["foo"] }); // void
+
+// appends to the file instead of rewriting
+writeJsonSync("./target.dat", { foo: "bar" }, { append: true });
```
### walk