Skip to content

Commit 0f9170e

Browse files
committed
doc: specify how to detect EOF
Specify how to detect end-of-file when using `fs.read()` and `filehandle.read()`. PR-URL: #35445 Fixes: #35363 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Zeyu Yang <[email protected]> Reviewed-By: Andrey Pechkurov <[email protected]>
1 parent e6d5af3 commit 0f9170e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

doc/api/fs.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2917,6 +2917,9 @@ If `position` is an integer, the file position will remain unchanged.
29172917

29182918
The callback is given the three arguments, `(err, bytesRead, buffer)`.
29192919

2920+
If the file is not modified concurrently, the end-of-file is reached when the
2921+
number of bytes read is zero.
2922+
29202923
If this method is invoked as its [`util.promisify()`][]ed version, it returns
29212924
a `Promise` for an `Object` with `bytesRead` and `buffer` properties.
29222925

@@ -4677,6 +4680,9 @@ Following successful read, the `Promise` is resolved with an object with a
46774680
`bytesRead` property specifying the number of bytes read, and a `buffer`
46784681
property that is a reference to the passed in `buffer` argument.
46794682

4683+
If the file is not modified concurrently, the end-of-file is reached when the
4684+
number of bytes read is zero.
4685+
46804686
#### `filehandle.read(options)`
46814687
<!-- YAML
46824688
added:

0 commit comments

Comments
 (0)