@@ -171,18 +171,13 @@ changes:
171
171
- version: v14.18.0
172
172
pr-url: https://github.com/nodejs/node/pull/37490
173
173
description: The `data` argument supports `AsyncIterable`, `Iterable` and `Stream`.
174
- - version: v14.12.0
175
- pr-url: https://github.com/nodejs/node/pull/34993
176
- description: The `data` parameter will stringify an object with an
177
- explicit `toString` function.
178
174
- version: v14.0.0
179
175
pr-url: https://github.com/nodejs/node/pull/31030
180
176
description: The `data` parameter won't coerce unsupported input to
181
177
strings anymore.
182
178
-->
183
179
184
- * ` data ` {string|Buffer|TypedArray|DataView|Object|AsyncIterable|Iterable
185
- |Stream}
180
+ * ` data ` {string|Buffer|TypedArray|DataView|AsyncIterable|Iterable|Stream}
186
181
* ` options ` {Object|string}
187
182
* ` encoding ` {string|null} ** Default:** ` 'utf8' `
188
183
* Returns: {Promise} Fulfills with ` undefined ` upon success.
@@ -425,21 +420,17 @@ promise with an error using code `UV_ENOSYS`.
425
420
<!-- YAML
426
421
added: v10.0.0
427
422
changes:
428
- - version: v14.12.0
429
- pr-url: https://github.com/nodejs/node/pull/34993
430
- description: The ` buffer` parameter will stringify an object with an
431
- explicit ` toString` function.
432
423
- version: v14.0.0
433
424
pr-url: https://github.com/nodejs/node/pull/31030
434
425
description: The ` buffer` parameter won't coerce unsupported input to
435
426
buffers anymore.
436
427
-->
437
428
438
- * ` buffer` {Buffer|TypedArray|DataView|string|Object }
429
+ * ` buffer` {Buffer|TypedArray|DataView}
439
430
* ` offset` {integer} The start position from within ` buffer` where the data
440
431
to write begins. **Default:** ` 0 `
441
432
* ` length` {integer} The number of bytes from ` buffer` to write. **Default:**
442
- ` buffer .byteLength `
433
+ ` buffer .byteLength - offset `
443
434
* ` position` {integer} The offset from the beginning of the file where the
444
435
data from ` buffer` should be written. If ` position` is not a ` number` ,
445
436
the data will be written at the current position. See the POSIX pwrite(2)
@@ -448,13 +439,10 @@ changes:
448
439
449
440
Write ` buffer` to the file.
450
441
451
- If ` buffer` is a plain object, it must have an own (not inherited) ` toString`
452
- function property.
453
-
454
442
The promise is resolved with an object containing two properties:
455
443
456
444
* ` bytesWritten` {integer} the number of bytes written
457
- * ` buffer` {Buffer|TypedArray|DataView|string|Object } a reference to the
445
+ * ` buffer` {Buffer|TypedArray|DataView} a reference to the
458
446
` buffer` written.
459
447
460
448
It is unsafe to use ` filehandle .write ()` multiple times on the same file
@@ -469,31 +457,27 @@ the end of the file.
469
457
<!-- YAML
470
458
added: v10.0.0
471
459
changes:
472
- - version: v14.12.0
473
- pr-url: https://github.com/nodejs/node/pull/34993
474
- description: The ` string` parameter will stringify an object with an
475
- explicit ` toString` function.
476
460
- version: v14.0.0
477
461
pr-url: https://github.com/nodejs/node/pull/31030
478
462
description: The ` string` parameter won't coerce unsupported input to
479
463
strings anymore.
480
464
-->
481
465
482
- * ` string` {string|Object }
466
+ * ` string` {string}
483
467
* ` position` {integer} The offset from the beginning of the file where the
484
468
data from ` string` should be written. If ` position` is not a ` number` the
485
469
data will be written at the current position. See the POSIX pwrite(2)
486
470
documentation for more detail.
487
471
* ` encoding` {string} The expected string encoding. **Default:** ` ' utf8' `
488
472
* Returns: {Promise}
489
473
490
- Write ` string` to the file. If ` string` is not a string, or an object with an
491
- own ` toString ` function property, the promise is rejected with an error.
474
+ Write ` string` to the file. If ` string` is not a string, the promise is
475
+ rejected with an error.
492
476
493
477
The promise is resolved with an object containing two properties:
494
478
495
479
* ` bytesWritten` {integer} the number of bytes written
496
- * ` buffer` {string|Object } a reference to the ` string` written.
480
+ * ` buffer` {string} a reference to the ` string` written.
497
481
498
482
It is unsafe to use ` filehandle .write ()` multiple times on the same file
499
483
without waiting for the promise to be resolved (or rejected). For this
@@ -510,27 +494,21 @@ changes:
510
494
- version: v14.18.0
511
495
pr-url: https://github.com/nodejs/node/pull/37490
512
496
description: The ` data` argument supports ` AsyncIterable` , ` Iterable` and ` Stream` .
513
- - version: v14.12.0
514
- pr-url: https://github.com/nodejs/node/pull/34993
515
- description: The ` data` parameter will stringify an object with an
516
- explicit ` toString` function.
517
497
- version: v14.0.0
518
498
pr-url: https://github.com/nodejs/node/pull/31030
519
499
description: The ` data` parameter won't coerce unsupported input to
520
500
strings anymore.
521
501
-->
522
502
523
- * ` data` {string|Buffer|TypedArray|DataView|Object|AsyncIterable|Iterable
524
- |Stream}
503
+ * ` data` {string|Buffer|TypedArray|DataView|AsyncIterable|Iterable|Stream}
525
504
* ` options` {Object|string}
526
505
* ` encoding` {string|null} The expected character encoding when ` data` is a
527
506
string. **Default:** ` ' utf8' `
528
507
* Returns: {Promise}
529
508
530
509
Asynchronously writes data to a file, replacing the file if it already exists.
531
- ` data` can be a string, a buffer, an {AsyncIterable} or {Iterable} object, or an
532
- object with an own ` toString` function
533
- property. The promise is resolved with no arguments upon success.
510
+ ` data` can be a string, a buffer, an {AsyncIterable} or {Iterable} object.
511
+ The promise is resolved with no arguments upon success.
534
512
535
513
If ` options` is a string, then it specifies the ` encoding` .
536
514
@@ -1274,19 +1252,14 @@ changes:
1274
1252
pr-url: https://github.com/nodejs/node/pull/35993
1275
1253
description: The options argument may include an AbortSignal to abort an
1276
1254
ongoing writeFile request.
1277
- - version: v14.12.0
1278
- pr-url: https://github.com/nodejs/node/pull/34993
1279
- description: The `data` parameter will stringify an object with an
1280
- explicit `toString` function.
1281
1255
- version: v14.0.0
1282
1256
pr-url: https://github.com/nodejs/node/pull/31030
1283
1257
description: The `data` parameter won't coerce unsupported input to
1284
1258
strings anymore.
1285
1259
-->
1286
1260
1287
1261
* `file` {string|Buffer|URL|FileHandle} filename or `FileHandle`
1288
- * `data` {string|Buffer|TypedArray|DataView|Object|AsyncIterable|Iterable
1289
- |Stream}
1262
+ * `data` {string|Buffer|TypedArray|DataView|AsyncIterable|Iterable|Stream}
1290
1263
* `options` {Object|string}
1291
1264
* `encoding` {string|null} **Default:** `'utf8'`
1292
1265
* `mode` {integer} **Default:** `0o666`
@@ -1295,8 +1268,7 @@ changes:
1295
1268
* Returns: {Promise} Fulfills with `undefined` upon success.
1296
1269
1297
1270
Asynchronously writes data to a file, replacing the file if it already exists.
1298
- `data` can be a string, a {Buffer}, or, an object with an own (not inherited)
1299
- `toString` function property.
1271
+ `data` can be a string, a buffer, an {AsyncIterable} or {Iterable} object.
1300
1272
1301
1273
The `encoding` option is ignored if `data` is a buffer.
1302
1274
@@ -3763,10 +3735,6 @@ This happens when:
3763
3735
<!-- YAML
3764
3736
added: v0.0.2
3765
3737
changes:
3766
- - version: v14.12.0
3767
- pr-url: https://github.com/nodejs/node/pull/34993
3768
- description: The ` buffer` parameter will stringify an object with an
3769
- explicit ` toString` function.
3770
3738
- version: v14.0.0
3771
3739
pr-url: https://github.com/nodejs/node/pull/31030
3772
3740
description: The ` buffer` parameter won't coerce unsupported input to
@@ -3792,7 +3760,7 @@ changes:
3792
3760
-->
3793
3761
3794
3762
* ` fd` {integer}
3795
- * ` buffer` {Buffer|TypedArray|DataView|string|Object }
3763
+ * ` buffer` {Buffer|TypedArray|DataView}
3796
3764
* ` offset` {integer}
3797
3765
* ` length` {integer}
3798
3766
* ` position` {integer}
@@ -3801,8 +3769,7 @@ changes:
3801
3769
* ` bytesWritten` {integer}
3802
3770
* ` buffer` {Buffer|TypedArray|DataView}
3803
3771
3804
- Write ` buffer` to the file specified by ` fd` . If ` buffer` is a normal object, it
3805
- must have an own ` toString` function property.
3772
+ Write ` buffer` to the file specified by ` fd` .
3806
3773
3807
3774
` offset` determines the part of the buffer to be written, and ` length` is
3808
3775
an integer specifying the number of bytes to write.
@@ -5046,10 +5013,6 @@ this API: [`fs.writeFile()`][].
5046
5013
<!-- YAML
5047
5014
added: v0.1.21
5048
5015
changes:
5049
- - version: v14.12.0
5050
- pr-url: https://github.com/nodejs/node/pull/34993
5051
- description: The ` buffer` parameter will stringify an object with an
5052
- explicit ` toString` function.
5053
5016
- version: v14.0.0
5054
5017
pr-url: https://github.com/nodejs/node/pull/31030
5055
5018
description: The ` buffer` parameter won't coerce unsupported input to
@@ -5067,26 +5030,19 @@ changes:
5067
5030
-->
5068
5031
5069
5032
* ` fd` {integer}
5070
- * ` buffer` {Buffer|TypedArray|DataView|string|Object }
5033
+ * ` buffer` {Buffer|TypedArray|DataView}
5071
5034
* ` offset` {integer}
5072
5035
* ` length` {integer}
5073
5036
* ` position` {integer}
5074
5037
* Returns: {number} The number of bytes written.
5075
5038
5076
- If ` buffer` is a plain object, it must have an own (not inherited) ` toString`
5077
- function property.
5078
-
5079
5039
For detailed information, see the documentation of the asynchronous version of
5080
5040
this API: [` fs .write (fd, buffer... )` ][].
5081
5041
5082
5042
### ` fs .writeSync (fd, string[, position[, encoding]])`
5083
5043
<!-- YAML
5084
5044
added: v0.11.5
5085
5045
changes:
5086
- - version: v14.12.0
5087
- pr-url: https://github.com/nodejs/node/pull/34993
5088
- description: The ` string` parameter will stringify an object with an
5089
- explicit ` toString` function.
5090
5046
- version: v14.0.0
5091
5047
pr-url: https://github.com/nodejs/node/pull/31030
5092
5048
description: The ` string` parameter won't coerce unsupported input to
@@ -5097,14 +5053,11 @@ changes:
5097
5053
-->
5098
5054
5099
5055
* ` fd` {integer}
5100
- * ` string` {string|Object }
5056
+ * ` string` {string}
5101
5057
* ` position` {integer}
5102
5058
* ` encoding` {string}
5103
5059
* Returns: {number} The number of bytes written.
5104
5060
5105
- If ` string` is a plain object, it must have an own (not inherited) ` toString`
5106
- function property.
5107
-
5108
5061
For detailed information, see the documentation of the asynchronous version of
5109
5062
this API: [` fs .write (fd, string... )` ][].
5110
5063
0 commit comments