diff options
author | Lucas Holmquist <lholmqui@redhat.com> | 2020-03-24 18:23:33 +0300 |
---|---|---|
committer | Beth Griggs <Bethany.Griggs@uk.ibm.com> | 2020-04-07 18:25:16 +0300 |
commit | 6d426bbb42a497427651e8054251e476b29cfbe3 (patch) | |
tree | 626c0f79b1b81fd23b0afd35b7dbf58675684800 /doc/api | |
parent | 5f7d881997a1a15bf2ef5314ece59caa6804603c (diff) |
fs: make parameters optional for readSync
This makes the offset, length and position parameters optional by
passing in an options object.
PR-URL: https://github.com/nodejs/node/pull/32460
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'doc/api')
-rw-r--r-- | doc/api/fs.md | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/doc/api/fs.md b/doc/api/fs.md index b4f429d6f4e..a0dff1c3008 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -3069,6 +3069,32 @@ Returns the number of `bytesRead`. For detailed information, see the documentation of the asynchronous version of this API: [`fs.read()`][]. +## `fs.readSync(fd, buffer, [options])` +<!-- YAML +added: REPLACEME +changes: + - version: REPLACEME + pr-url: https://github.com/nodejs/node/pull/32460 + description: Options object can be passed in + to make offset, length and position optional +--> + +* `fd` {integer} +* `buffer` {Buffer|TypedArray|DataView} +* `options` {Object} + * `offset` {integer} **Default:** `0` + * `length` {integer} **Default:** `buffer.length` + * `position` {integer} **Default:** `null` +* Returns: {number} + +Returns the number of `bytesRead`. + +Similar to the above `fs.readSync` function, this version takes an optional `options` object. +If no `options` object is specified, it will default with the above values. + +For detailed information, see the documentation of the asynchronous version of +this API: [`fs.read()`][]. + ## `fs.readv(fd, buffers[, position], callback)` <!-- YAML added: REPLACEME |