mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
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>
This commit is contained in:
committed by
Anna Henningsen
parent
05da0bbadc
commit
88b4e86fd7
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user