diff options
author | Luigi Pinca <luigipinca@gmail.com> | 2020-10-01 16:51:40 +0300 |
---|---|---|
committer | Danielle Adams <adamzdanielle@gmail.com> | 2020-10-06 19:16:06 +0300 |
commit | e40876a5e569d270b7ad051f1354eae335a29263 (patch) | |
tree | 8f93a6adc5bcbd3c906afff481c9b6f6cd3cd4ec /doc | |
parent | 541ce17386d5e9531ac954c109a498911d0a55a3 (diff) |
doc: specify how to detect EOF
Specify how to detect end-of-file when using `fs.read()` and
`filehandle.read()`.
PR-URL: https://github.com/nodejs/node/pull/35445
Fixes: https://github.com/nodejs/node/issues/35363
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Zeyu Yang <himself65@outlook.com>
Reviewed-By: Andrey Pechkurov <apechkurov@gmail.com>
Diffstat (limited to 'doc')
-rw-r--r-- | doc/api/fs.md | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/doc/api/fs.md b/doc/api/fs.md index 72357443ece..36d3fc10f4d 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -2909,6 +2909,9 @@ If `position` is an integer, the file position will remain unchanged. The callback is given the three arguments, `(err, bytesRead, buffer)`. +If the file is not modified concurrently, the end-of-file is reached when the +number of bytes read is zero. + If this method is invoked as its [`util.promisify()`][]ed version, it returns a `Promise` for an `Object` with `bytesRead` and `buffer` properties. @@ -4657,6 +4660,9 @@ Following successful read, the `Promise` is resolved with an object with a `bytesRead` property specifying the number of bytes read, and a `buffer` property that is a reference to the passed in `buffer` argument. +If the file is not modified concurrently, the end-of-file is reached when the +number of bytes read is zero. + #### `filehandle.read(options)` <!-- YAML added: v13.11.0 |