8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
fs.md
1 parent 72b90fd commit 924670fCopy full SHA for 924670f
doc/api/fs.md
@@ -374,7 +374,7 @@ added: v10.0.0
374
file data read.
375
* `offset` {integer} The location in the buffer at which to start filling.
376
* `length` {integer} The number of bytes to read.
377
-* `position` {integer} The location where to begin reading data from the
+* `position` {integer|null} The location where to begin reading data from the
378
file. If `null`, data will be read from the current file position, and
379
the position will be updated. If `position` is an integer, the current
380
file position will remain unchanged.
@@ -403,7 +403,7 @@ added:
403
**Default:** `0`
404
* `length` {integer} The number of bytes to read. **Default:**
405
`buffer.byteLength - offset`
406
- * `position` {integer} The location where to begin reading data from the
+ * `position` {integer|null} The location where to begin reading data from the
407
408
409
file position will remain unchanged. **Default:**: `null`
@@ -497,9 +497,9 @@ added:
497
-->
498
499
* `buffers` {Buffer\[]|TypedArray\[]|DataView\[]}
500
-* `position` {integer} The offset from the beginning of the file where the data
501
- should be read from. If `position` is not a `number`, the data will be read
502
- from the current position.
+* `position` {integer|null} The offset from the beginning of the file where
+ the data should be read from. If `position` is not a `number`, the data will
+ be read from the current position. **Default:** `null`
503
* Returns: {Promise} Fulfills upon success an object containing two properties:
504
* `bytesRead` {integer} the number of bytes read
505
* `buffers` {Buffer\[]|TypedArray\[]|DataView\[]} property containing
@@ -597,10 +597,10 @@ changes:
597
to write begins. **Default:** `0`
598
* `length` {integer} The number of bytes from `buffer` to write. **Default:**
599
600
-* `position` {integer} The offset from the beginning of the file where the
+* `position` {integer|null} The offset from the beginning of the file where the
601
data from `buffer` should be written. If `position` is not a `number`,
602
the data will be written at the current position. See the POSIX pwrite(2)
603
- documentation for more detail.
+ documentation for more detail. **Default:** `null`
604
* Returns: {Promise}
605
606
Write `buffer` to the file.
@@ -631,10 +631,10 @@ changes:
631
632
633
* `string` {string}
634
635
data from `string` should be written. If `position` is not a `number` the
636
data will be written at the current position. See the POSIX pwrite(2)
637
638
* `encoding` {string} The expected string encoding. **Default:** `'utf8'`
639
640
@@ -699,9 +699,9 @@ added: v12.9.0
699
700
701
702
703
data from `buffers` should be written. If `position` is not a `number`,
704
- the data will be written at the current position.
+ the data will be written at the current position. **Default:** `null`
705
706
707
Write an array of {ArrayBufferView}s to the file.
@@ -3194,7 +3194,7 @@ changes:
3194
written to.
3195
* `offset` {integer} The position in `buffer` to write the data to.
3196
3197
-* `position` {integer|bigint} Specifies where to begin reading from in the
+* `position` {integer|bigint|null} Specifies where to begin reading from in the
3198
file. If `position` is `null` or `-1 `, data will be read from the current
3199
file position, and the file position will be updated. If `position` is an
3200
integer, the file position will be unchanged.
@@ -3233,7 +3233,7 @@ changes:
3233
* `buffer` {Buffer|TypedArray|DataView} **Default:** `Buffer.alloc(16384)`
3234
* `offset` {integer} **Default:** `0`
3235
* `length` {integer} **Default:** `buffer.byteLength - offset`
3236
- * `position` {integer|bigint} **Default:** `null`
+ * `position` {integer|bigint|null} **Default:** `null`
3237
* `callback` {Function}
3238
* `err` {Error}
3239
* `bytesRead` {integer}
@@ -3498,7 +3498,7 @@ changes:
3498
3499
* `fd` {integer}
3500
* `buffers` {ArrayBufferView\[]}
3501
-* `position` {integer}
+* `position` {integer|null} **Default:** `null`
3502
3503
3504
@@ -3920,7 +3920,7 @@ changes:
3920
3921
* `target` {string|Buffer|URL}
3922
* `path` {string|Buffer|URL}
3923
-* `type` {string}
+* `type` {string|null} **Default:** `null`
3924
3925
3926
@@ -3931,8 +3931,8 @@ See the POSIX symlink(2) documentation for more details.
3931
3932
The `type` argument is only available on Windows and ignored on other platforms.
3933
It can be set to `'dir'`, `'file'`, or `'junction'`. If the `type` argument is
3934
-not set, Node.js will autodetect `target` type and use `'file'` or `'dir'`. If
3935
-the `target` does not exist, `'file'` will be used. Windows junction points
+not a string, Node.js will autodetect `target` type and use `'file'` or `'dir'`.
+If the `target` does not exist, `'file'` will be used. Windows junction points
3936
require the destination path to be absolute. When using `'junction'`, the
3937
`target` argument will automatically be normalized to absolute path.
3938
@@ -4359,9 +4359,9 @@ changes:
4359
4360
4361
* `buffer` {Buffer|TypedArray|DataView}
4362
-* `offset` {integer}
4363
-* `length` {integer}
4364
+* `offset` {integer} **Default:** `0`
+* `length` {integer} **Default:** `buffer.byteLength - offset`
4365
4366
4367
* `bytesWritten` {integer}
@@ -4422,7 +4422,7 @@ changes:
4422
4423
4424
* `string` {string|Object}
4425
4426
* `encoding` {string} **Default:** `'utf8'`
4427
4428
@@ -4623,7 +4623,7 @@ changes:
4623
4624
4625
4626
4627
4628
4629
@@ -5338,7 +5338,7 @@ object with an `encoding` property specifying the character encoding to use for
5338
the link path returned. If the `encoding` is set to `'buffer'`,
5339
the link path returned will be passed as a {Buffer} object.
5340
5341
-### `fs.readSync(fd, buffer, offset, length, position)`
+ A3DB ### `fs.readSync(fd, buffer, offset, length[, position])`
5342
5343
<!-- YAML
5344
added: v0.1.21
@@ -5356,7 +5356,7 @@ changes:
5356
5357
* `offset` {integer}
5358
* `length` {integer}
5359
-* `position` {integer|bigint}
+* `position` {integer|bigint|null} **Default:** `null`
5360
* Returns: {number}
5361
5362
Returns the number of `bytesRead`.
@@ -5384,7 +5384,7 @@ changes:
5384
* `options` {Object}
5385
5386
5387
5388
5389
5390
@@ -5405,7 +5405,7 @@ added:
5405
5406
5407
5408
5409
* Returns: {number} The number of bytes read.
5410
5411
For detailed information, see the documentation of the asynchronous version of
@@ -5629,7 +5629,7 @@ changes:
5629
5630
5631
5632
5633
5634
Returns `undefined`.
5635
@@ -5761,9 +5761,9 @@ changes:
5761
5762
5763
5764
5765
5766
5767
* Returns: {number} The number of bytes written.
5768
5769
@@ -5785,8 +5785,8 @@ changes:
5785
5786
5787
5788
5789
-* `encoding` {string}
+* `encoding` {string} **Default:** `'utf8'`
5790
5791
5792
@@ -5800,7 +5800,7 @@ added: v12.9.0
5800
5801
5802
5803
5804
5805
5806
lib/fs.js
@@ -597,7 +597,7 @@ function openSync(path, flags, mode) {
* @param {Buffer | TypedArray | DataView} buffer
* @param {number} offset
* @param {number} length
- * @param {number | bigint} position
+ * @param {number | bigint | null} position
* @param {(
* err?: Error,
* bytesRead?: number,
@@ -682,7 +682,7 @@ ObjectDefineProperty(read, internalUtil.customPromisifyArgs,
682
* @param {{
683
* offset?: number;
684
* length?: number;
685
- * position?: number | bigint;
+ * position?: number | bigint | null;
686
* }} [offset]
687
* @returns {number}
688
*/
@@ -738,7 +738,7 @@ function readSync(fd, buffer, offset, length, position) {
738
* and writes to an array of `ArrayBufferView`s.
739
* @param {number} fd
740
* @param {ArrayBufferView[]} buffers
741
- * @param {number} [position]
+ * @param {number | null} [position]
742
743
744
@@ -773,7 +773,7 @@ ObjectDefineProperty(readv, internalUtil.customPromisifyArgs,
773
* of `ArrayBufferView`s.
774
775
776
777
778
779
function readvSync(fd, buffers, position) {
@@ -796,7 +796,7 @@ function readvSync(fd, buffers, position) {
796
* @param {Buffer | TypedArray | DataView | string | object} buffer
797
* @param {number} [offset]
798
* @param {number} [length]
799
800
801
802
* bytesWritten?: number;
@@ -864,7 +864,7 @@ ObjectDefineProperty(write, internalUtil.customPromisifyArgs,
864
* @param {Buffer | TypedArray | DataView | string} buffer
865
866
867
868
869
870
function writeSync(fd, buffer, offset, length, position) {
@@ -902,7 +902,7 @@ function writeSync(fd, buffer, offset, length, position) {
902
* specified `fd` (file descriptor).
903
904
905
906
907
908
* bytesWritten?: number,
@@ -943,7 +943,7 @@ ObjectDefineProperty(writev, internalUtil.customPromisifyArgs, {
943
* to the specified `fd` (file descriptor).
944
945
946
947
948
949
function writevSync(fd, buffers, position) {
@@ -1601,7 +1601,7 @@ function readlinkSync(path, options) {
1601
* Creates the link called `path` pointing to `target`.
1602
* @param {string | Buffer | URL} target
1603
* @param {string | Buffer | URL} path
1604
- * @param {string} [type_]
+ * @param {string | null} [type_]
1605
* @param {(err?: Error) => any} callback_
1606
* @returns {void}
1607
@@ -1654,7 +1654,7 @@ function symlink(target, path, type_, callback_) {
1654
* pointing to `target`.
1655
1656
1657
- * @param {string} [type]
+ * @param {string | null} [type]
1658
1659
1660
function symlinkSync(target, path, type) {