-
Notifications
You must be signed in to change notification settings - Fork 30k
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
doc: clarify behaviour of writeFile(fd) #27282
Conversation
doc/api/fs.md
Outdated
When `file` is a file descriptor, the behaviour is almost identical to directly | ||
calling [`fs.write()`][] like: | ||
```javascript | ||
fs.write(fd, Buffer.from(options.encoding), callback); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Buffer.from(options.encoding)
seems a bit confusing here. Is something missing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clearer now?
@@ -3615,14 +3619,33 @@ It is unsafe to use `fs.writeFile()` multiple times on the same file without | |||
waiting for the callback. For this scenario, [`fs.createWriteStream()`][] is | |||
recommended. | |||
|
|||
### File Descriptors | |||
1. Any specified file descriptor has to support writing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are 1 and 2 skipped intentionally?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, now, the difference from fs.write() is described, rather than the previous more complicated way of describing the fd behaviour.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3 was skipped as well -- which makes the entire previous list being replaced.
This is a continuing source of confusion, attempt to make it even more clear. Fixes: nodejs#24923
881b78c
to
e9f2aff
Compare
@vsemozhetbyt PTAL |
This is a continuing source of confusion, attempt to make it even more clear. Fixes: nodejs#24923 PR-URL: nodejs#27282 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Landed in a763de1 |
This is a continuing source of confusion, attempt to make it even more
clear.
Fixes: #24923
Checklist