Skip to content

Commit

Permalink
doc: clarify fs.createReadStream options
Browse files Browse the repository at this point in the history
* start/end start *counting* at 0
* If fd is specified and start is omitted or undefined,
  fs.createReadStream() reads sequentially from the current file
  position.

Fixes: #7099
PR-URL: #10078
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Roman Reiss <me@silverwind.io>
  • Loading branch information
WesTyler authored and addaleax committed Dec 5, 2016
1 parent 44d9bc8 commit 78e188d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion doc/api/fs.md
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,9 @@ default value of 64 kb for the same parameter.

`options` can include `start` and `end` values to read a range of bytes from
the file instead of the entire file. Both `start` and `end` are inclusive and
start at 0. The `encoding` can be any one of those accepted by [`Buffer`][].
start counting at 0. If `fd` is specified and `start` is omitted or `undefined`,
`fs.createReadStream()` reads sequentially from the current file position.
The `encoding` can be any one of those accepted by [`Buffer`][].

If `fd` is specified, `ReadStream` will ignore the `path` argument and will use
the specified file descriptor. This means that no `'open'` event will be
Expand Down

0 comments on commit 78e188d

Please sign in to comment.