@@ -265,18 +265,20 @@ added: v10.0.0
265
265
added: v10.0.0
266
266
-->
267
267
268
- * ` buffer` {Buffer|Uint8Array } A buffer that will be filled with the file
269
- data read.
268
+ * ` buffer` {Buffer|TypedArray|DataView } A buffer that will be filled with the
269
+ file data read.
270
270
* ` offset` {integer} The location in the buffer at which to start filling.
271
271
**Default:** ` 0 `
272
- * ` length` {integer} The number of bytes to read. **Default:** ` buffer .length `
272
+ * ` length` {integer} The number of bytes to read. **Default:**
273
+ ` buffer .byteLength `
273
274
* ` position` {integer} The location where to begin reading data from the
274
275
file. If ` null ` , data will be read from the current file position, and
275
276
the position will be updated. If ` position` is an integer, the current
276
277
file position will remain unchanged.
277
278
* Returns: {Promise} Fulfills upon success with an object with two properties:
278
279
* ` bytesRead` {integer} The number of bytes read
279
- * ` buffer` {Buffer|Uint8Array} A reference to the passed in ` buffer` argument.
280
+ * ` buffer` {Buffer|TypedArray|DataView} A reference to the passed in ` buffer`
281
+ argument.
280
282
281
283
Reads data from the file and stores that in the given buffer.
282
284
@@ -290,19 +292,20 @@ added:
290
292
- v12.17.0
291
293
-->
292
294
* ` options` {Object}
293
- * ` buffer` {Buffer|Uint8Array } A buffer that will be filled with the file
294
- data read. **Default:** ` Buffer .alloc (16384 )`
295
+ * ` buffer` {Buffer|TypedArray|DataView } A buffer that will be filled with the
296
+ file data read. **Default:** ` Buffer .alloc (16384 )`
295
297
* ` offset` {integer} The location in the buffer at which to start filling.
296
298
**Default:** ` 0 `
297
- * ` length` {integer} The number of bytes to read. **Default:** ` buffer .length `
299
+ * ` length` {integer} The number of bytes to read. **Default:**
300
+ ` buffer .byteLength `
298
301
* ` position` {integer} The location where to begin reading data from the
299
302
file. If ` null ` , data will be read from the current file position, and
300
303
the position will be updated. If ` position` is an integer, the current
301
304
file position will remain unchanged. **Default:**: ` null `
302
305
* Returns: {Promise} Fulfills upon success with an object with two properties:
303
306
* ` bytesRead` {integer} The number of bytes read
304
- * ` buffer` {Buffer|Uint8Array } A reference to the passed in ` buffer`
305
- argument.
307
+ * ` buffer` {Buffer|TypedArray|DataView } A reference to the passed in ` buffer`
308
+ argument.
306
309
307
310
Reads data from the file and stores that in the given buffer.
308
311
@@ -434,10 +437,11 @@ changes:
434
437
buffers anymore.
435
438
-->
436
439
437
- * ` buffer` {Buffer|Uint8Array |string|Object}
440
+ * ` buffer` {Buffer|TypedArray|DataView |string|Object}
438
441
* ` offset` {integer} The start position from within ` buffer` where the data
439
- to write begins.
440
- * ` length` {integer} The number of bytes from ` buffer` to write.
442
+ to write begins. **Default:** ` 0 `
443
+ * ` length` {integer} The number of bytes from ` buffer` to write. **Default:**
444
+ ` buffer .byteLength `
441
445
* ` position` {integer} The offset from the beginning of the file where the
442
446
data from ` buffer` should be written. If ` position` is not a ` number` ,
443
447
the data will be written at the current position. See the POSIX pwrite(2)
@@ -449,8 +453,8 @@ Write `buffer` to the file.
449
453
The promise is resolved with an object containing two properties:
450
454
451
455
* ` bytesWritten` {integer} the number of bytes written
452
- * ` buffer` {Buffer|Uint8Array| string|Object} a reference to the ` buffer `
453
- written.
456
+ * ` buffer` {Buffer|TypedArray|DataView| string|Object} a reference to the
457
+ ` buffer ` written.
454
458
455
459
It is unsafe to use ` filehandle .write ()` multiple times on the same file
456
460
without waiting for the promise to be resolved (or rejected). For this
@@ -512,7 +516,7 @@ changes:
512
516
strings anymore.
513
517
-->
514
518
515
- * ` data` {string|Buffer|Uint8Array |Object}
519
+ * ` data` {string|Buffer|TypedArray|DataView |Object}
516
520
* ` options` {Object|string}
517
521
* ` encoding` {string|null} The expected character encoding when ` data` is a
518
522
string. **Default:** ` ' utf8' `
@@ -1270,7 +1274,7 @@ changes:
1270
1274
-->
1271
1275
1272
1276
* `file` {string|Buffer|URL|FileHandle} filename or `FileHandle`
1273
- * `data` {string|Buffer|Uint8Array |Object|AsyncIterable|Iterable
1277
+ * `data` {string|Buffer|TypedArray|DataView |Object|AsyncIterable|Iterable
1274
1278
|Stream}
1275
1279
* `options` {Object|string}
1276
1280
* `encoding` {string|null} **Default:** `'utf8'`
@@ -2722,9 +2726,11 @@ changes:
2722
2726
2723
2727
* ` fd` {integer}
2724
2728
* ` buffer` {Buffer|TypedArray|DataView} The buffer that the data will be
2725
- written to.
2726
- * ` offset` {integer} The position in ` buffer` to write the data to.
2727
- * ` length` {integer} The number of bytes to read.
2729
+ written to. **Default:** ` Buffer .alloc (16384 )`
2730
+ * ` offset` {integer} The position in ` buffer` to write the data to. **Default:**
2731
+ ` 0 `
2732
+ * ` length` {integer} The number of bytes to read. **Default:**
2733
+ ` buffer .byteLength `
2728
2734
* ` position` {integer|bigint} Specifies where to begin reading from in the
2729
2735
file. If ` position` is ` null ` or ` - 1 ` , data will be read from the current
2730
2736
file position, and the file position will be updated. If ` position` is an
@@ -2761,7 +2767,7 @@ changes:
2761
2767
* ` options` {Object}
2762
2768
* ` buffer` {Buffer|TypedArray|DataView} **Default:** ` Buffer .alloc (16384 )`
2763
2769
* ` offset` {integer} **Default:** ` 0 `
2764
- * ` length` {integer} **Default:** ` buffer .length `
2770
+ * ` length` {integer} **Default:** ` buffer .byteLength `
2765
2771
* ` position` {integer|bigint} **Default:** ` null `
2766
2772
* ` callback` {Function}
2767
2773
* ` err` {Error}
@@ -4689,7 +4695,7 @@ changes:
4689
4695
* ` buffer` {Buffer|TypedArray|DataView}
4690
4696
* ` options` {Object}
4691
4697
* ` offset` {integer} **Default:** ` 0 `
4692
- * ` length` {integer} **Default:** ` buffer .length `
4698
+ * ` length` {integer} **Default:** ` buffer .byteLength `
4693
4699
* ` position` {integer|bigint} **Default:** ` null `
4694
4700
* Returns: {number}
4695
4701
0 commit comments