Skip to content

Commit

Permalink
doc: update behaviour of fs.writeFile
Browse files Browse the repository at this point in the history
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

PR-URL: #25080
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Weijia Wang <starkwang@126.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
  • Loading branch information
thefourtheye authored and addaleax committed Jan 7, 2019
1 parent 0066fdb commit 309e772
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions doc/api/fs.md
Original file line number Diff line number Diff line change
Expand Up @@ -3614,10 +3614,10 @@ recommended.
1. Any specified file descriptor has to support writing.
2. If a file descriptor is specified as the `file`, it will not be closed
automatically.
3. The writing will begin at the beginning of the file. For example, if the
file already had `'Hello World'` and the newly written content is `'Aloha'`,
then the contents of the file would be `'Aloha World'`, rather than just
`'Aloha'`.
3. The writing will begin at the current position. For example, if the string
`'Hello'` is written to the file descriptor, and if `', World'` is written with
`fs.writeFile()` to the same file descriptor, the contents of the file would
become `'Hello, World'`, instead of just `', World'`.


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

0 comments on commit 309e772

Please sign in to comment.