@@ -185,18 +185,13 @@ changes:
185
185
- v14.18.0
186
186
pr-url: https://github.com/nodejs/node/pull/37490
187
187
description: The `data` argument supports `AsyncIterable`, `Iterable` and `Stream`.
188
- - version: v14.12.0
189
- pr-url: https://github.com/nodejs/node/pull/34993
190
- description: The `data` parameter will stringify an object with an
191
- explicit `toString` function.
192
188
- version: v14.0.0
193
189
pr-url: https://github.com/nodejs/node/pull/31030
194
190
description: The `data` parameter won't coerce unsupported input to
195
191
strings anymore.
196
192
-->
197
193
198
- * ` data ` {string|Buffer|TypedArray|DataView|Object|AsyncIterable|Iterable
199
- |Stream}
194
+ * ` data ` {string|Buffer|TypedArray|DataView|AsyncIterable|Iterable|Stream}
200
195
* ` options ` {Object|string}
201
196
* ` encoding ` {string|null} ** Default:** ` 'utf8' `
202
197
* Returns: {Promise} Fulfills with ` undefined ` upon success.
@@ -544,21 +539,17 @@ then resolves the promise with no arguments upon success.
544
539
<!-- YAML
545
540
added: v10.0.0
546
541
changes:
547
- - version: v14.12.0
548
- pr-url: https://github.com/nodejs/node/pull/34993
549
- description: The ` buffer` parameter will stringify an object with an
550
- explicit ` toString` function.
551
542
- version: v14.0.0
552
543
pr-url: https://github.com/nodejs/node/pull/31030
553
544
description: The ` buffer` parameter won't coerce unsupported input to
554
545
buffers anymore.
555
546
-->
556
547
557
- * ` buffer` {Buffer|TypedArray|DataView|string|Object }
548
+ * ` buffer` {Buffer|TypedArray|DataView}
558
549
* ` offset` {integer} The start position from within ` buffer` where the data
559
550
to write begins. **Default:** ` 0 `
560
551
* ` length` {integer} The number of bytes from ` buffer` to write. **Default:**
561
- ` buffer .byteLength `
552
+ ` buffer .byteLength - offset `
562
553
* ` position` {integer} The offset from the beginning of the file where the
563
554
data from ` buffer` should be written. If ` position` is not a ` number` ,
564
555
the data will be written at the current position. See the POSIX pwrite(2)
@@ -567,13 +558,10 @@ changes:
567
558
568
559
Write ` buffer` to the file.
569
560
570
- If ` buffer` is a plain object, it must have an own (not inherited) ` toString`
571
- function property.
572
-
573
561
The promise is resolved with an object containing two properties:
574
562
575
563
* ` bytesWritten` {integer} the number of bytes written
576
- * ` buffer` {Buffer|TypedArray|DataView|string|Object } a reference to the
564
+ * ` buffer` {Buffer|TypedArray|DataView} a reference to the
577
565
` buffer` written.
578
566
579
567
It is unsafe to use ` filehandle .write ()` multiple times on the same file
@@ -589,31 +577,27 @@ the end of the file.
589
577
<!-- YAML
590
578
added: v10.0.0
591
579
changes:
592
- - version: v14.12.0
593
- pr-url: https://github.com/nodejs/node/pull/34993
594
- description: The ` string` parameter will stringify an object with an
595
- explicit ` toString` function.
596
580
- version: v14.0.0
597
581
pr-url: https://github.com/nodejs/node/pull/31030
598
582
description: The ` string` parameter won't coerce unsupported input to
599
583
strings anymore.
600
584
-->
601
585
602
- * ` string` {string|Object }
586
+ * ` string` {string}
603
587
* ` position` {integer} The offset from the beginning of the file where the
604
588
data from ` string` should be written. If ` position` is not a ` number` the
605
589
data will be written at the current position. See the POSIX pwrite(2)
606
590
documentation for more detail.
607
591
* ` encoding` {string} The expected string encoding. **Default:** ` ' utf8' `
608
592
* Returns: {Promise}
609
593
610
- Write ` string` to the file. If ` string` is not a string, or an object with an
611
- own ` toString ` function property, the promise is rejected with an error.
594
+ Write ` string` to the file. If ` string` is not a string, the promise is
595
+ rejected with an error.
612
596
613
597
The promise is resolved with an object containing two properties:
614
598
615
599
* ` bytesWritten` {integer} the number of bytes written
616
- * ` buffer` {string|Object } a reference to the ` string` written.
600
+ * ` buffer` {string} a reference to the ` string` written.
617
601
618
602
It is unsafe to use ` filehandle .write ()` multiple times on the same file
619
603
without waiting for the promise to be resolved (or rejected). For this
@@ -631,27 +615,21 @@ changes:
631
615
- version: v15.14.0
632
616
pr-url: https://github.com/nodejs/node/pull/37490
633
617
description: The ` data` argument supports ` AsyncIterable` , ` Iterable` and ` Stream` .
634
- - version: v14.12.0
635
- pr-url: https://github.com/nodejs/node/pull/34993
636
- description: The ` data` parameter will stringify an object with an
637
- explicit ` toString` function.
638
618
- version: v14.0.0
639
619
pr-url: https://github.com/nodejs/node/pull/31030
640
620
description: The ` data` parameter won't coerce unsupported input to
641
621
strings anymore.
642
622
-->
643
623
644
- * ` data` {string|Buffer|TypedArray|DataView|Object|AsyncIterable|Iterable
645
- |Stream}
624
+ * ` data` {string|Buffer|TypedArray|DataView|AsyncIterable|Iterable|Stream}
646
625
* ` options` {Object|string}
647
626
* ` encoding` {string|null} The expected character encoding when ` data` is a
648
627
string. **Default:** ` ' utf8' `
649
628
* Returns: {Promise}
650
629
651
630
Asynchronously writes data to a file, replacing the file if it already exists.
652
- ` data` can be a string, a buffer, an {AsyncIterable} or {Iterable} object, or an
653
- object with an own ` toString` function
654
- property. The promise is resolved with no arguments upon success.
631
+ ` data` can be a string, a buffer, an {AsyncIterable} or {Iterable} object.
632
+ The promise is resolved with no arguments upon success.
655
633
656
634
If ` options` is a string, then it specifies the ` encoding` .
657
635
@@ -1509,19 +1487,14 @@ changes:
1509
1487
pr-url: https://github.com/nodejs/node/pull/35993
1510
1488
description: The options argument may include an AbortSignal to abort an
1511
1489
ongoing writeFile request.
1512
- - version: v14.12.0
1513
- pr-url: https://github.com/nodejs/node/pull/34993
1514
- description: The `data` parameter will stringify an object with an
1515
- explicit `toString` function.
1516
1490
- version: v14.0.0
1517
1491
pr-url: https://github.com/nodejs/node/pull/31030
1518
1492
description: The `data` parameter won't coerce unsupported input to
1519
1493
strings anymore.
1520
1494
-->
1521
1495
1522
1496
* `file` {string|Buffer|URL|FileHandle} filename or `FileHandle`
1523
- * `data` {string|Buffer|TypedArray|DataView|Object|AsyncIterable|Iterable
1524
- |Stream}
1497
+ * `data` {string|Buffer|TypedArray|DataView|AsyncIterable|Iterable|Stream}
1525
1498
* `options` {Object|string}
1526
1499
* `encoding` {string|null} **Default:** `'utf8'`
1527
1500
* `mode` {integer} **Default:** `0o666`
@@ -1530,8 +1503,7 @@ changes:
1530
1503
* Returns: {Promise} Fulfills with `undefined` upon success.
1531
1504
1532
1505
Asynchronously writes data to a file, replacing the file if it already exists.
1533
- `data` can be a string, a {Buffer}, or, an object with an own (not inherited)
1534
- `toString` function property.
1506
+ `data` can be a string, a buffer, an {AsyncIterable} or {Iterable} object.
1535
1507
1536
1508
The `encoding` option is ignored if `data` is a buffer.
1537
1509
@@ -4128,10 +4100,6 @@ This happens when:
4128
4100
<!-- YAML
4129
4101
added: v0.0.2
4130
4102
changes:
4131
- - version: v14.12.0
4132
- pr-url: https://github.com/nodejs/node/pull/34993
4133
- description: The `buffer` parameter will stringify an object with an
4134
- explicit `toString` function.
4135
4103
- version: v14.0.0
4136
4104
pr-url: https://github.com/nodejs/node/pull/31030
4137
4105
description: The `buffer` parameter won' t coerce unsupported input to
@@ -4157,7 +4125,7 @@ changes:
4157
4125
-->
4158
4126
4159
4127
* ` fd` {integer}
4160
- * ` buffer` {Buffer| TypedArray| DataView | string | Object }
4128
+ * ` buffer` {Buffer| TypedArray| DataView }
4161
4129
* ` offset` {integer}
4162
4130
* ` length` {integer}
4163
4131
* ` position` {integer}
@@ -4166,8 +4134,7 @@ changes:
4166
4134
* ` bytesWritten` {integer}
4167
4135
* ` buffer` {Buffer| TypedArray| DataView }
4168
4136
4169
- Write ` buffer` to the file specified by ` fd` . If ` buffer` is a normal object, it
4170
- must have an own ` toString` function property.
4137
+ Write ` buffer` to the file specified by ` fd` .
4171
4138
4172
4139
` offset` determines the part of the buffer to be written, and ` length` is
4173
4140
an integer specifying the number of bytes to write.
@@ -5520,10 +5487,6 @@ this API: [`fs.writeFile()`][].
5520
5487
<!-- YAML
5521
5488
added: v0.1.21
5522
5489
changes:
5523
- - version: v14.12.0
5524
- pr-url: https://github.com/nodejs/node/pull/34993
5525
- description: The ` buffer` parameter will stringify an object with an
5526
- explicit ` toString` function.
5527
5490
- version: v14.0.0
5528
5491
pr-url: https://github.com/nodejs/node/pull/31030
5529
5492
description: The ` buffer` parameter won't coerce unsupported input to
@@ -5541,15 +5504,12 @@ changes:
5541
5504
-->
5542
5505
5543
5506
* ` fd` {integer}
5544
- * ` buffer` {Buffer|TypedArray|DataView|string|Object }
5507
+ * ` buffer` {Buffer|TypedArray|DataView}
5545
5508
* ` offset` {integer}
5546
5509
* ` length` {integer}
5547
5510
* ` position` {integer}
5548
5511
* Returns: {number} The number of bytes written.
5549
5512
5550
- If ` buffer` is a plain object, it must have an own (not inherited) ` toString`
5551
- function property.
5552
-
5553
5513
For detailed information, see the documentation of the asynchronous version of
5554
5514
this API: [` fs .write (fd, buffer... )` ][].
5555
5515
@@ -5558,10 +5518,6 @@ this API: [`fs.write(fd, buffer...)`][].
5558
5518
<!-- YAML
5559
5519
added: v0.11.5
5560
5520
changes:
5561
- - version: v14.12.0
5562
- pr-url: https://github.com/nodejs/node/pull/34993
5563
- description: The ` string` parameter will stringify an object with an
5564
- explicit ` toString` function.
5565
5521
- version: v14.0.0
5566
5522
pr-url: https://github.com/nodejs/node/pull/31030
5567
5523
description: The ` string` parameter won't coerce unsupported input to
@@ -5572,14 +5528,11 @@ changes:
5572
5528
-->
5573
5529
5574
5530
* ` fd` {integer}
5575
- * ` string` {string|Object }
5531
+ * ` string` {string}
5576
5532
* ` position` {integer}
5577
5533
* ` encoding` {string}
5578
5534
* Returns: {number} The number of bytes written.
5579
5535
5580
- If ` string` is a plain object, it must have an own (not inherited) ` toString`
5581
- function property.
5582
-
5583
5536
For detailed information, see the documentation of the asynchronous version of
5584
5537
this API: [` fs .write (fd, string... )` ][].
5585
5538
0 commit comments