Skip to content

Commit 55822cf

Browse files
committed
doc: update behaviour of fs.writeFile
As per the decision in #23433, the `fs.writeFile` will always write from the current position if it is used with file descriptors. This patch updates it. Ref: #23709
1 parent b54d4a6 commit 55822cf

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

doc/api/fs.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -3605,10 +3605,10 @@ recommended.
36053605
1. Any specified file descriptor has to support writing.
36063606
2. If a file descriptor is specified as the `file`, it will not be closed
36073607
automatically.
3608-
3. The writing will begin at the beginning of the file. For example, if the
3609-
file already had `'Hello World'` and the newly written content is `'Aloha'`,
3610-
then the contents of the file would be `'Aloha World'`, rather than just
3611-
`'Aloha'`.
3608+
3. The writing will begin at the current position. For example, if the string
3609+
`'Hello'` is written to the file descriptor, and if `', World'` is written with
3610+
`fs.writeFile()` to the same file descriptor, the contents of the file would
3611+
become `'Hello, World'`, instead of just `', World'`.
36123612

36133613

36143614
## fs.writeFileSync(file, data[, options])

0 commit comments

Comments
 (0)