From 5d9003a699e05253e50c421c50becb52dafdcd4b Mon Sep 17 00:00:00 2001 From: Vse Mozhet Byt Date: Sun, 19 Aug 2018 18:24:56 +0300 Subject: [PATCH] doc: clarify fs.write[Sync]() descriptions 1. All default values for optional `encoding` parameters were documented except for the one in `fs.write(fd, string...)` method. This PR makes up this deficiency. Refs: https://github.com/nodejs/node/blob/a04f2f7df630427bf869b1e04040975b752973b6/lib/fs.js#L549 2. We have two variants of `fs.write()` / `fs.writeSync()` methods: for buffers and strings. Currently, the sync methods have only one common reference to the full description of async methods. However, the link may seem to belong to the last sync variant only (for strings) and, as it refers to the first async variant (for buffers), this may be confusing. This PR makes two different sync variants refer to two different async variants. 3. In passing, both returned values of sync methods were also made more concise and unambiguous. --- doc/api/fs.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/doc/api/fs.md b/doc/api/fs.md index 01023eb56e3e52..493093eee01155 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -3422,7 +3422,7 @@ changes: * `fd` {integer} * `string` {string} * `position` {integer} -* `encoding` {string} +* `encoding` {string} **Default:** `'utf8'` * `callback` {Function} * `err` {Error} * `written` {integer} @@ -3548,7 +3548,10 @@ changes: * `offset` {integer} * `length` {integer} * `position` {integer} -* Returns: {number} +* Returns: {number} The number of bytes written. + +For detailed information, see the documentation of the asynchronous version of +this API: [`fs.write(fd, buffer...)`][]. ## fs.writeSync(fd, string[, position[, encoding]])