From ab5806d8a62bbd673a15f31b3e79492f1ce88dc5 Mon Sep 17 00:00:00 2001 From: "Sakthipriyan Vairamani (thefourtheye)" Date: Wed, 26 Dec 2018 13:09:36 +0530 Subject: [PATCH] doc: update behaviour of fs.writeFile As per the decision in https://github.com/nodejs/node/issues/23433, the `fs.writeFile` will always write from the current position if it is used with file descriptors. This patch updates it. Ref: https://github.com/nodejs/node/pull/23709 PR-URL: https://github.com/nodejs/node/pull/25080 Reviewed-By: Daniel Bevenius Reviewed-By: Weijia Wang Reviewed-By: Matteo Collina Reviewed-By: Anto Aravinth Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Vse Mozhet Byt Reviewed-By: Rod Vagg Reviewed-By: Trivikram Kamat --- doc/api/fs.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/api/fs.md b/doc/api/fs.md index 5535b66c5c6456..523520b2239b5c 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -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])