@@ -186,7 +186,7 @@ added: v10.0.0
186186* ` data ` {string|Buffer|TypedArray|DataView}
187187* ` options ` {Object|string}
188188 * ` encoding ` {string|null} ** Default:** ` 'utf8' `
189- * Returns: {Promise}
189+ * Returns: {Promise} Fulfills with ` undefined ` upon success.
190190
191191Alias of [ ` filehandle.writeFile() ` ] [ ] .
192192
@@ -199,33 +199,31 @@ to with [`fsPromises.open()`][]. Therefore, this is equivalent to
199199added: v10.0.0
200200-->
201201
202- * ` mode ` {integer}
203- * Returns: {Promise}
202+ * ` mode ` {integer} the file mode bit mask.
203+ * Returns: {Promise} Fulfills with ` undefined ` upon success.
204204
205- Modifies the permissions on the file. The promise is resolved with no
206- arguments upon success.
205+ Modifies the permissions on the file. See chmod(2).
207206
208207#### ` filehandle.chown(uid, gid) `
209208<!-- YAML
210209added: v10.0.0
211210-->
212211
213- * ` uid ` {integer}
214- * ` gid ` {integer}
215- * Returns: {Promise}
212+ * ` uid ` {integer} The file's new owner's user id.
213+ * ` gid ` {integer} * ` gid ` {integer} The file's new group's group id.
214+ * Returns: {Promise} Fulfills with ` undefined ` upon success.
216215
217- Changes the ownership of the file then resolves the promise with no arguments
218- upon success.
216+ Changes the ownership of the file. A wrapper for chown(2).
219217
220218#### ` filehandle.close() `
221219<!-- YAML
222220added: v10.0.0
223221-->
224222
225- * Returns: {Promise}
223+ * Returns: {Promise} Fulfills with ` undefined ` upon success.
226224
227225Closes the file handle after waiting for any pending operation on the handle to
228- complete. The promise is resolved with no arguments once complete.
226+ complete.
229227
230228``` js esm
231229import { open } from ' fs/promises' ;
@@ -243,13 +241,13 @@ try {
243241added: v10.0.0
244242-->
245243
246- * Returns: {Promise}
244+ * Returns: {Promise} Fulfills with ` undefined ` upon success.
247245
248246Forces all currently queued I/O operations associated with the file to the
249247operating system's synchronized I/O completion state. Refer to the POSIX
250- fdatasync(2) documentation for details. The promise is resolved with no
251- arguments upon success.
248+ fdatasync(2) documentation for details.
252249
250+ Unlike ` filehandle .sync ` this method does not flush modified metadata.
253251#### ` filehandle .fd `
254252<!-- YAML
255253added: v10.0.0
@@ -271,16 +269,12 @@ added: v10.0.0
271269 file. If ` null ` , data will be read from the current file position, and
272270 the position will be updated. If ` position` is an integer, the current
273271 file position will remain unchanged.
274- * Returns: {Promise}
272+ * Returns: {Promise} Fulfills upon success with an object with two properties:
273+ * ` bytesRead` {integer} The number of bytes read
274+ * ` buffer` {Buffer|Uint8Array} A reference to the passed in ` buffer` argument.
275275
276276Reads data from the file and stores that in the given buffer.
277277
278- Following successful read, the promise is resolved with an object with
279- two properties:
280-
281- * ` bytesRead` {integer} The number of bytes read
282- * ` buffer` {Buffer|Uint8Array} A reference to the passed in ` buffer` argument.
283-
284278If the file is not modified concurrently, the end-of-file is reached when the
285279number of bytes read is zero.
286280
@@ -300,16 +294,13 @@ added:
300294 file. If ` null ` , data will be read from the current file position, and
301295 the position will be updated. If ` position` is an integer, the current
302296 file position will remain unchanged. **Default:**: ` null `
303- * Returns: {Promise}
297+ * Returns: {Promise} Fulfills upon success with an object with two properties:
298+ * ` bytesRead` {integer} The number of bytes read
299+ * ` buffer` {Buffer|Uint8Array} A reference to the passed in ` buffer`
300+ argument.
304301
305302Reads data from the file and stores that in the given buffer.
306303
307- Following successful read, the promise is resolved with an object with
308- two properties:
309-
310- * ` bytesRead` {integer} The number of bytes read
311- * ` buffer` {Buffer|Uint8Array} A reference to the passed in ` buffer` argument.
312-
313304If the file is not modified concurrently, the end-of-file is reached when the
314305number of bytes read is zero.
315306
@@ -321,14 +312,12 @@ added: v10.0.0
321312* ` options` {Object|string}
322313 * ` encoding` {string|null} **Default:** ` null `
323314 * ` signal` {AbortSignal} allows aborting an in-progress readFile
324- * Returns: {Promise}
315+ * Returns: {Promise} Fulfills upon a successful read with the contents of the
316+ file. If no encoding is specified (using ` options .encoding ` ), the data is
317+ returned as a {Buffer} object. Otherwise, the data will be a string.
325318
326319Asynchronously reads the entire contents of a file.
327320
328- The promise is resolved with the contents of the file. If no encoding is
329- specified (using ` options .encoding ` ), the data is returned as a {Buffer}
330- object. Otherwise, the data will be a string.
331-
332321If ` options` is a string, then it specifies the ` encoding` .
333322
334323The {FileHandle} has to support reading.
@@ -349,16 +338,13 @@ added:
349338* ` position` {integer} The offset from the beginning of the file where the data
350339 should be read from. If ` position` is not a ` number` , the data will be read
351340 from the current position.
352- * Returns: {Promise}
341+ * Returns: {Promise} Fulfills upon success an object containing two properties:
342+ * ` bytesRead` {integer} the number of bytes read
343+ * ` buffers` {Buffer[]|TypedArray[]|DataView[]} property containing
344+ a reference to the ` buffers` input.
353345
354346Read from a file and write to an array of {ArrayBufferView}s
355347
356- The promise is resolved with an object containing two properties:
357-
358- * ` bytesRead` {integer} the number of bytes read
359- * ` buffers` {Buffer[]|TypedArray[]|DataView[]} property containing
360- a reference to the ` buffers` input.
361-
362348#### ` filehandle .stat ([options])`
363349<!-- YAML
364350added: v10.0.0
@@ -372,32 +358,30 @@ changes:
372358* ` options` {Object}
373359 * ` bigint` {boolean} Whether the numeric values in the returned
374360 {fs.Stats} object should be ` bigint` . **Default:** ` false ` .
375- * Returns: {Promise}
361+ * Returns: {Promise} Fulfills with an {fs.Stats} for the file.
362+
376363
377- Resolves the promise with the {fs.Stats} for the file.
378364
379365#### ` filehandle .sync ()`
380366<!-- YAML
381367added: v10.0.0
382368-->
383369
384- * Returns: {Promise}
370+ * Returns: {Promise} Fufills with ` undefined ` upon success.
385371
386372Request that all data for the open file descriptor is flushed to the storage
387373device. The specific implementation is operating system and device specific.
388374Refer to the POSIX fsync(2) documentation for more detail.
389375
390- The promise is resolved with no arguments upon success.
391-
392376#### ` filehandle .truncate (len)`
393377<!-- YAML
394378added: v10.0.0
395379-->
396380
397381* ` len` {integer} **Default:** ` 0 `
398- * Returns: {Promise}
382+ * Returns: {Promise} Fulfills with ` undefined ` upo nsuccess.
399383
400- Truncates the file then resolves the promise with no arguments upon success .
384+ Truncates the file.
401385
402386If the file was larger than ` len` bytes, only the first ` len` bytes will be
403387retained in the file.
@@ -2681,8 +2665,8 @@ changes:
26812665* `offset` {integer} The position in `buffer` to write the data to.
26822666* `length` {integer} The number of bytes to read.
26832667* `position` {integer|bigint} Specifies where to begin reading from in the
2684- file. If `position` is `null`, data will be read from the current file
2685- position, and the file position will be updated. If `position` is an
2668+ file. If `position` is `null` or `-1 ` , data will be read from the current
2669+ file position, and the file position will be updated. If `position` is an
26862670 integer, the file position will be unchanged.
26872671* `callback` {Function}
26882672 * `err` {Error}
@@ -4199,8 +4183,8 @@ added: v0.4.7
41994183-->
42004184
42014185* ` fd` {integer}
4202- * ` uid` {integer}
4203- * ` gid` {integer}
4186+ * ` uid` {integer} The file's new owner's user id.
4187+ * ` gid` {integer} * ` gid ` {integer} The file's new group's group id.
42044188
42054189Sets the owner of the file. Returns ` undefined ` .
42064190
@@ -4302,8 +4286,8 @@ changes:
43024286-->
43034287
43044288* ` path` {string|Buffer|URL}
4305- * ` uid` {integer}
4306- * ` gid` {integer}
4289+ * ` uid` {integer} The file's new owner's user id.
4290+ * ` gid` {integer} * ` gid ` {integer} The file's new group's group id.
43074291
43084292Set the owner for the path. Returns ` undefined ` .
43094293
0 commit comments