Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e40876a

Browse filesBrowse files
lpincadanielleadams
authored andcommitted
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 <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>
1 parent 541ce17 commit e40876a
Copy full SHA for e40876a

File tree

Expand file treeCollapse file tree

1 file changed

+6
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-0
lines changed
Open diff view settings
Collapse file

‎doc/api/fs.md‎

Copy file name to clipboardExpand all lines: doc/api/fs.md
+6Lines changed: 6 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -2909,6 +2909,9 @@ If `position` is an integer, the file position will remain unchanged.
29092909

29102910
The callback is given the three arguments, `(err, bytesRead, buffer)`.
29112911

2912+
If the file is not modified concurrently, the end-of-file is reached when the
2913+
number of bytes read is zero.
2914+
29122915
If this method is invoked as its [`util.promisify()`][]ed version, it returns
29132916
a `Promise` for an `Object` with `bytesRead` and `buffer` properties.
29142917

@@ -4657,6 +4660,9 @@ Following successful read, the `Promise` is resolved with an object with a
46574660
`bytesRead` property specifying the number of bytes read, and a `buffer`
46584661
property that is a reference to the passed in `buffer` argument.
46594662

4663+
If the file is not modified concurrently, the end-of-file is reached when the
4664+
number of bytes read is zero.
4665+
46604666
#### `filehandle.read(options)`
46614667
<!-- YAML
46624668
added: v13.11.0

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.