Skip to content

Commit

Permalink
doc: add descriptions about when options.mode is ignored
Browse files Browse the repository at this point in the history
PR-URL: #39881
Fixes: #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>
  • Loading branch information
rayw000 authored and jasnell committed Sep 3, 2021
1 parent c68faa9 commit 9fdb726
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions doc/api/fs.md
Original file line number Diff line number Diff line change
Expand Up @@ -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()`).
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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';
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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';

Expand Down Expand Up @@ -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()`][].
Expand Down

0 comments on commit 9fdb726

Please sign in to comment.