Skip to content

Commit 1c579ec

Browse files
aduh95targos
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 a5507fd commit 1c579ec

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
@@ -578,7 +578,7 @@ The promise is resolved with an object containing two properties:
578578
579579
It is unsafe to use `filehandle.write()` multiple times on the same file
580580
without waiting for the promise to be resolved (or rejected). For this
581-
scenario, use [`fs.createWriteStream()`][].
581+
scenario, use [`filehandle.createWriteStream()`][].
582582
583583
On Linux, positional writes do not work when the file is opened in append mode.
584584
The kernel ignores the position argument and always appends the data to
@@ -617,7 +617,7 @@ The promise is resolved with an object containing two properties:
617617
618618
It is unsafe to use `filehandle.write()` multiple times on the same file
619619
without waiting for the promise to be resolved (or rejected). For this
620-
scenario, use [`fs.createWriteStream()`][].
620+
scenario, use [`filehandle.createWriteStream()`][].
621621
622622
On Linux, positional writes do not work when the file is opened in append mode.
623623
The kernel ignores the position argument and always appends the data to
@@ -1520,7 +1520,7 @@ without waiting for the promise to be settled.
15201520
Similarly to `fsPromises.readFile` - `fsPromises.writeFile` is a convenience
15211521
method that performs multiple `write` calls internally to write the buffer
15221522
passed to it. For performance sensitive code consider using
1523-
[`fs.createWriteStream()`][].
1523+
[`fs.createWriteStream()`][] or [`filehandle.createWriteStream()`][].
15241524
15251525
It is possible to use an {AbortSignal} to cancel an `fsPromises.writeFile()`.
15261526
Cancelation is "best effort", and some amount of data is likely still
@@ -7226,6 +7226,7 @@ the file contents.
72267226
[`ReadDirectoryChangesW`]: https://docs.microsoft.com/en-us/windows/desktop/api/winbase/nf-winbase-readdirectorychangesw
72277227
[`UV_THREADPOOL_SIZE`]: cli.md#uv_threadpool_sizesize
72287228
[`event ports`]: https://illumos.org/man/port_create
7229+
[`filehandle.createWriteStream()`]: #filehandlecreatewritestreamoptions
72297230
[`filehandle.writeFile()`]: #filehandlewritefiledata-options
72307231
[`fs.access()`]: #fsaccesspath-mode-callback
72317232
[`fs.accessSync()`]: #fsaccesssyncpath-mode

0 commit comments

Comments
 (0)