Skip to content

Commit 3614d45

Browse files
aduh95juanarbol
authored andcommitted
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 41303d7 commit 3614d45

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

doc/api/fs.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ The promise is resolved with an object containing two properties:
566566
567567
It is unsafe to use `filehandle.write()` multiple times on the same file
568568
without waiting for the promise to be resolved (or rejected). For this
569-
scenario, use [`fs.createWriteStream()`][].
569+
scenario, use [`filehandle.createWriteStream()`][].
570570
571571
On Linux, positional writes do not work when the file is opened in append mode.
572572
The kernel ignores the position argument and always appends the data to
@@ -601,7 +601,7 @@ The promise is resolved with an object containing two properties:
601601
602602
It is unsafe to use `filehandle.write()` multiple times on the same file
603603
without waiting for the promise to be resolved (or rejected). For this
604-
scenario, use [`fs.createWriteStream()`][].
604+
scenario, use [`filehandle.createWriteStream()`][].
605605
606606
On Linux, positional writes do not work when the file is opened in append mode.
607607
The kernel ignores the position argument and always appends the data to
@@ -1492,7 +1492,7 @@ without waiting for the promise to be settled.
14921492
Similarly to `fsPromises.readFile` - `fsPromises.writeFile` is a convenience
14931493
method that performs multiple `write` calls internally to write the buffer
14941494
passed to it. For performance sensitive code consider using
1495-
[`fs.createWriteStream()`][].
1495+
[`fs.createWriteStream()`][] or [`filehandle.createWriteStream()`][].
14961496
14971497
It is possible to use an {AbortSignal} to cancel an `fsPromises.writeFile()`.
14981498
Cancelation is "best effort", and some amount of data is likely still
@@ -7186,6 +7186,7 @@ the file contents.
71867186
[`ReadDirectoryChangesW`]: https://docs.microsoft.com/en-us/windows/desktop/api/winbase/nf-winbase-readdirectorychangesw
71877187
[`UV_THREADPOOL_SIZE`]: cli.md#uv_threadpool_sizesize
71887188
[`event ports`]: https://illumos.org/man/port_create
7189+
[`filehandle.createWriteStream()`]: #filehandlecreatewritestreamoptions
71897190
[`filehandle.writeFile()`]: #filehandlewritefiledata-options
71907191
[`fs.access()`]: #fsaccesspath-mode-callback
71917192
[`fs.accessSync()`]: #fsaccesssyncpath-mode

0 commit comments

Comments
 (0)