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 f4ca007

Browse filesBrowse files
XeCyclervagg
authored andcommitted
doc: clarify that fs streams expect blocking fd
This clarifies that fs.createReadStream and fs.createWriteStream, when passed a fd, expects the fd to be blocking, and suggests net.Socket as an alternative. PR-URL: #3641 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent f29c5d6 commit f4ca007
Copy full SHA for f4ca007

File tree

Expand file treeCollapse file tree

1 file changed

+4
-1
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-1
lines changed
Open diff view settings
Collapse file

‎doc/api/fs.markdown‎

Copy file name to clipboardExpand all lines: doc/api/fs.markdown
+4-1Lines changed: 4 additions & 1 deletion
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,8 @@ start at 0. The `encoding` can be any one of those accepted by [Buffer][].
307307

308308
If `fd` is specified, `ReadStream` will ignore the `path` argument and will use
309309
the specified file descriptor. This means that no `open` event will be emitted.
310+
Note that `fd` should be blocking; non-blocking `fd`s should be passed to
311+
`net.Socket`.
310312

311313
If `autoClose` is false, then the file descriptor won't be closed, even if
312314
there's an error. It is your responsibility to close it and make sure
@@ -341,7 +343,8 @@ default mode `w`. The `defaultEncoding` can be any one of those accepted by [Buf
341343

342344
Like `ReadStream` above, if `fd` is specified, `WriteStream` will ignore the
343345
`path` argument and will use the specified file descriptor. This means that no
344-
`open` event will be emitted.
346+
`open` event will be emitted. Note that `fd` should be blocking; non-blocking
347+
`fd`s should be passed to `net.Socket`.
345348

346349
If `options` is a string, then it specifies the encoding.
347350

0 commit comments

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