Skip to content

Commit a82713c

Browse files
authored
doc: recommend fh.createWriteStream for fsPromises methods
`fh.createWriteStream` can be more convenient than `fs.createWriteStream` when using the FS promises API. PR-URL: #42653 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Akhil Marsonya <[email protected]> Reviewed-By: Mestery <[email protected]>
1 parent 6d4b017 commit a82713c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

doc/api/fs.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ The promise is resolved with an object containing two properties:
613613
614614
It is unsafe to use `filehandle.write()` multiple times on the same file
615615
without waiting for the promise to be resolved (or rejected). For this
616-
scenario, use [`fs.createWriteStream()`][].
616+
scenario, use [`filehandle.createWriteStream()`][].
617617
618618
On Linux, positional writes do not work when the file is opened in append mode.
619619
The kernel ignores the position argument and always appends the data to
@@ -648,7 +648,7 @@ The promise is resolved with an object containing two properties:
648648
649649
It is unsafe to use `filehandle.write()` multiple times on the same file
650650
without waiting for the promise to be resolved (or rejected). For this
651-
scenario, use [`fs.createWriteStream()`][].
651+
scenario, use [`filehandle.createWriteStream()`][].
652652
653653
On Linux, positional writes do not work when the file is opened in append mode.
654654
The kernel ignores the position argument and always appends the data to
@@ -1547,7 +1547,7 @@ without waiting for the promise to be settled.
15471547
Similarly to `fsPromises.readFile` - `fsPromises.writeFile` is a convenience
15481548
method that performs multiple `write` calls internally to write the buffer
15491549
passed to it. For performance sensitive code consider using
1550-
[`fs.createWriteStream()`][].
1550+
[`fs.createWriteStream()`][] or [`filehandle.createWriteStream()`][].
15511551
15521552
It is possible to use an {AbortSignal} to cancel an `fsPromises.writeFile()`.
15531553
Cancelation is "best effort", and some amount of data is likely still
@@ -7471,6 +7471,7 @@ the file contents.
74717471
[`ReadDirectoryChangesW`]: https://docs.microsoft.com/en-us/windows/desktop/api/winbase/nf-winbase-readdirectorychangesw
74727472
[`UV_THREADPOOL_SIZE`]: cli.md#uv_threadpool_sizesize
74737473
[`event ports`]: https://illumos.org/man/port_create
7474+
[`filehandle.createWriteStream()`]: #filehandlecreatewritestreamoptions
74747475
[`filehandle.writeFile()`]: #filehandlewritefiledata-options
74757476
[`fs.access()`]: #fsaccesspath-mode-callback
74767477
[`fs.accessSync()`]: #fsaccesssyncpath-mode

0 commit comments

Comments
 (0)