Skip to content

Commit 175a656

Browse files
JakobJingleheimertargos
authored andcommitted
doc: add annotation to writeFile data as Object
Fixes: #39152 PR-URL: #39167 Reviewed-By: Antoine du Hamel <[email protected]>
1 parent 4d53c63 commit 175a656

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

Diff for: doc/api/fs.md

+17-3
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,9 @@ changes:
440440
441441
Write `buffer` to the file.
442442
443+
If `buffer` is a plain object, it must have an own (not inherited) `toString`
444+
function property.
445+
443446
The promise is resolved with an object containing two properties:
444447
445448
* `bytesWritten` {integer} the number of bytes written
@@ -1284,8 +1287,8 @@ changes:
12841287
* Returns: {Promise} Fulfills with `undefined` upon success.
12851288
12861289
Asynchronously writes data to a file, replacing the file if it already exists.
1287-
`data` can be a string, a {Buffer}, or an object with an own `toString` function
1288-
property.
1290+
`data` can be a string, a {Buffer}, or, an object with an own (not inherited)
1291+
`toString` function property.
12891292
12901293
The `encoding` option is ignored if `data` is a buffer.
12911294
@@ -3937,7 +3940,9 @@ When `file` is a file descriptor, the behavior is similar to calling
39373940
a file descriptor.
39383941
39393942
The `encoding` option is ignored if `data` is a buffer.
3940-
If `data` is a normal object, it must have an own `toString` function property.
3943+
3944+
If `data` is a plain object, it must have an own (not inherited) `toString`
3945+
function property.
39413946
39423947
```mjs
39433948
import { writeFile } from 'fs';
@@ -5031,6 +5036,9 @@ changes:
50315036
50325037
Returns `undefined`.
50335038
5039+
If `data` is a plain object, it must have an own (not inherited) `toString`
5040+
function property.
5041+
50345042
For detailed information, see the documentation of the asynchronous version of
50355043
this API: [`fs.writeFile()`][].
50365044
@@ -5065,6 +5073,9 @@ changes:
50655073
* `position` {integer}
50665074
* Returns: {number} The number of bytes written.
50675075
5076+
If `buffer` is a plain object, it must have an own (not inherited) `toString`
5077+
function property.
5078+
50685079
For detailed information, see the documentation of the asynchronous version of
50695080
this API: [`fs.write(fd, buffer...)`][].
50705081
@@ -5091,6 +5102,9 @@ changes:
50915102
* `encoding` {string}
50925103
* Returns: {number} The number of bytes written.
50935104
5105+
If `string` is a plain object, it must have an own (not inherited) `toString`
5106+
function property.
5107+
50945108
For detailed information, see the documentation of the asynchronous version of
50955109
this API: [`fs.write(fd, string...)`][].
50965110

0 commit comments

Comments
 (0)