Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRay <ray@isrc.iscas.ac.cn>2021-08-25 16:12:30 +0300
committerJames M Snell <jasnell@gmail.com>2021-09-03 17:41:00 +0300
commit9fdb7262a766eaee022678e10c0129aee2c8f853 (patch)
treef33ccab93eb595b6db9a2643bacecea0b0c5d30d /doc/api/fs.md
parentc68faa9575923a1632bfc76eb60bfb2dea036735 (diff)
doc: add descriptions about when `options.mode` is ignored
PR-URL: https://github.com/nodejs/node/pull/39881 Fixes: https://github.com/nodejs/node/issues/39859 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Diffstat (limited to 'doc/api/fs.md')
-rw-r--r--doc/api/fs.md18
1 files changed, 18 insertions, 0 deletions
diff --git a/doc/api/fs.md b/doc/api/fs.md
index f41ebdf56ce..3be576e175e 100644
--- a/doc/api/fs.md
+++ b/doc/api/fs.md
@@ -664,6 +664,9 @@ exist. `data` can be a string or a {Buffer}.
If `options` is a string, then it specifies the `encoding`.
+The `mode` option only affects the newly created file. See [`fs.open()`][]
+for more details.
+
The `path` may be specified as a {FileHandle} that has been opened
for appending (using `fsPromises.open()`).
@@ -1379,6 +1382,9 @@ The `encoding` option is ignored if `data` is a buffer.
If `options` is a string, then it specifies the encoding.
+The `mode` option only affects the newly created file. See [`fs.open()`][]
+for more details.
+
Any specified {FileHandle} has to support writing.
It is unsafe to use `fsPromises.writeFile()` multiple times on the same file
@@ -1645,6 +1651,9 @@ changes:
Asynchronously append data to a file, creating the file if it does not yet
exist. `data` can be a string or a {Buffer}.
+The `mode` option only affects the newly created file. See [`fs.open()`][]
+for more details.
+
```mjs
import { appendFile } from 'fs';
@@ -4086,6 +4095,9 @@ a file descriptor.
The `encoding` option is ignored if `data` is a buffer.
+The `mode` option only affects the newly created file. See [`fs.open()`][]
+for more details.
+
If `data` is a plain object, it must have an own (not inherited) `toString`
function property.
@@ -4260,6 +4272,9 @@ changes:
Synchronously append data to a file, creating the file if it does not yet
exist. `data` can be a string or a {Buffer}.
+The `mode` option only affects the newly created file. See [`fs.open()`][]
+for more details.
+
```mjs
import { appendFileSync } from 'fs';
@@ -5216,6 +5231,9 @@ Returns `undefined`.
If `data` is a plain object, it must have an own (not inherited) `toString`
function property.
+The `mode` option only affects the newly created file. See [`fs.open()`][]
+for more details.
+
For detailed information, see the documentation of the asynchronous version of
this API: [`fs.writeFile()`][].