Browse Source

doc: clarify fs.createReadStream options

* 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: https://github.com/nodejs/node/issues/7099
PR-URL: https://github.com/nodejs/node/pull/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>
v4.x
Wes Tyler 8 years ago
committed by Myles Borins
parent
commit
ad841a29d1
  1. 4
      doc/api/fs.md

4
doc/api/fs.md

@ -503,7 +503,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 emitted.

Loading…
Cancel
Save