summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorZYSzys <17367077526@163.com>2019-02-10 12:16:53 +0800
committerLuigi Pinca <luigipinca@gmail.com>2019-02-10 09:22:36 +0100
commit70f4f08a9f0902056ac47271f9d3a761fcee4715 (patch)
tree18594addd9871c782463f4f52d2d1df74ce2d6ae /doc
parente154176b7cc397399ccb939b920b308f8d5cb874 (diff)
downloadandroid-node-v8-70f4f08a9f0902056ac47271f9d3a761fcee4715.tar.gz
android-node-v8-70f4f08a9f0902056ac47271f9d3a761fcee4715.tar.bz2
android-node-v8-70f4f08a9f0902056ac47271f9d3a761fcee4715.zip
fs: harden validation of start option in createWriteStream
PR-URL: https://github.com/nodejs/node/pull/25579 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Diffstat (limited to 'doc')
-rw-r--r--doc/api/fs.md12
1 files changed, 8 insertions, 4 deletions
diff --git a/doc/api/fs.md b/doc/api/fs.md
index 523520b223..53a504f3ec 100644
--- a/doc/api/fs.md
+++ b/doc/api/fs.md
@@ -1470,9 +1470,11 @@ returned by this method has a default `highWaterMark` of 64 kb.
`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 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`][].
+start counting at 0, allowed values are in the
+[0, [`Number.MAX_SAFE_INTEGER`][]] range. 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
@@ -1548,7 +1550,8 @@ changes:
* Returns: {fs.WriteStream} See [Writable Stream][].
`options` may also include a `start` option to allow writing data at
-some position past the beginning of the file. Modifying a file rather
+some position past the beginning of the file, allowed values are in the
+[0, [`Number.MAX_SAFE_INTEGER`][]] range. Modifying a file rather
than replacing it may require a `flags` mode of `r+` rather than the
default mode `w`. The `encoding` can be any one of those accepted by
[`Buffer`][].
@@ -4953,3 +4956,4 @@ the file contents.
[chcp]: https://ss64.com/nt/chcp.html
[inode]: https://en.wikipedia.org/wiki/Inode
[support of file system `flags`]: #fs_file_system_flags
+[`Number.MAX_SAFE_INTEGER`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER