-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
What does fs.read
's length
argument indicate?
#52447
Comments
fs.read
's length
property indicate?fs.read
's length
argument indicate?
@nodejs/fs |
Yes, you need to loop. |
Great - thank you, this matches my expectation. Do you want to keep this issue open to track updates of the docs or shall I close it? |
I think we should keep it open so that someone improves the doc to avoid confusing future readers. |
is it still open , can i still contribute ? |
#52453 was merged, so I guess this can be closed. |
Affected URL(s)
https://nodejs.org/api/fs.html#fsreadfd-buffer-offset-length-position-callback
Description of the problem
It is not clear from Node's
fs.read()
docs, whether thelength
argument indicates the maximum number of bytes that Node will attempt to read from the kernel, or whether Node will return exactlylength
bytes (possibly making multipleread
syscalls in the process).Ie: if I call
fs.read()
with length = 10, which of these holds:bytesRead
is set to 9.bytesRead
is set to 10.bytesRead
is set to 5.This is an important thing to document because it determines whether you need to wrap the
read
call in a loop (like the Linux syscall) if you need a minimum amount of bytes, or whether you do not have to do this.The text was updated successfully, but these errors were encountered: