@@ -874,6 +874,10 @@ changes:
874
874
Calls ` filehandle .close ()` and returns a promise that fulfills when the
875
875
filehandle is closed.
876
876
877
+ This method enables the filehandle to be used with [` await using` ][], which
878
+ will automatically close the file when the scope exits. For more information,
879
+ see the [MDN documentation on ` using` statements][` using` ].
880
+
877
881
### ` fsPromises .access (path[, mode])`
878
882
879
883
<!-- YAML
@@ -1342,10 +1346,11 @@ directory cannot be deleted, disposal will throw an error. The object has an
1342
1346
async ` remove ()` method which will perform the same task.
1343
1347
1344
1348
Both this function and the disposal function on the resulting object are
1345
- async, so it should be used with ` await ` + ` await using` as in
1349
+ async, so it should be used with ` await ` + [ ` await using` ] as in
1346
1350
` await using dir = await fsPromises .mkdtempDisposable (' prefix' )` .
1347
1351
1348
- <!-- TODO: link MDN docs for disposables once https://github.com/mdn/content/pull/38027 lands -->
1352
+ See the [MDN documentation on ` using` statements][` using` ] for more information about
1353
+ explicit resource management.
1349
1354
1350
1355
For detailed information, see the documentation of [` fsPromises .mkdtemp ()` ][].
1351
1356
@@ -5971,12 +5976,13 @@ removed if it still exists. If the directory cannot be deleted, disposal will
5971
5976
throw an error. The object has a ` remove ()` method which will perform the same
5972
5977
task.
5973
5978
5974
- <!-- TODO: link MDN docs for disposables once https://github.com/mdn/content/pull/38027 lands -->
5979
+ See the [MDN documentation on ` using` statements][` using` ] for more information about
5980
+ explicit resource management.
5975
5981
5976
5982
For detailed information, see the documentation of [` fs .mkdtemp ()` ][].
5977
5983
5978
5984
There is no callback-based version of this API because it is designed for use
5979
- with the ` using` syntax.
5985
+ with the [ ` using` ][] syntax.
5980
5986
5981
5987
The optional ` options` argument can be a string specifying an encoding, or an
5982
5988
object with an ` encoding` property specifying the character encoding to use.
@@ -6838,6 +6844,10 @@ changes:
6838
6844
Calls ` dir .close ()` if the directory handle is open, and returns a promise that
6839
6845
fulfills when disposal is complete.
6840
6846
6847
+ This method enables the directory to be used with [` await using` ][], which
6848
+ will automatically close the directory when the scope exits. For more
6849
+ information, see the [MDN documentation on ` using` statements][` using` ].
6850
+
6841
6851
#### ` dir[Symbol .dispose ]()`
6842
6852
6843
6853
<!-- YAML
@@ -6853,6 +6863,10 @@ changes:
6853
6863
Calls ` dir .closeSync ()` if the directory handle is open, and returns
6854
6864
` undefined ` .
6855
6865
6866
+ This method enables the directory to be used with [` using` ][], which
6867
+ will automatically close the directory when the scope exits. For more
6868
+ information, see the [MDN documentation on ` using` statements][` using` ].
6869
+
6856
6870
### Class: ` fs .Dirent `
6857
6871
6858
6872
<!-- YAML
@@ -7893,6 +7907,10 @@ the `data` argument must be a {Buffer}.
7893
7907
7894
7908
Calls ` utf8Stream .destroy ()` .
7895
7909
7910
+ This method enables the stream to be used with [` using` ][], which
7911
+ will automatically destroy the stream when the scope exits. For more
7912
+ information, see the [MDN documentation on ` using` statements][` using` ].
7913
+
7896
7914
### Class: ` fs .WriteStream `
7897
7915
7898
7916
<!-- YAML
@@ -8708,6 +8726,7 @@ the file contents.
8708
8726
[` Number .MAX_SAFE_INTEGER ` ]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER
8709
8727
[` ReadDirectoryChangesW` ]: https://docs.microsoft.com/en-us/windows/desktop/api/winbase/nf-winbase-readdirectorychangesw
8710
8728
[` UV_THREADPOOL_SIZE ` ]: cli.md#uv_threadpool_sizesize
8729
+ [` await using` ]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/await_using
8711
8730
[` event ports` ]: https://illumos.org/man/port_create
8712
8731
[` filehandle .createReadStream ()` ]: #filehandlecreatereadstreamoptions
8713
8732
[` filehandle .createWriteStream ()` ]: #filehandlecreatewritestreamoptions
@@ -8760,6 +8779,7 @@ the file contents.
8760
8779
[` fsPromises .utimes ()` ]: #fspromisesutimespath-atime-mtime
8761
8780
[` inotify (7 )` ]: https://man7.org/linux/man-pages/man7/inotify.7.html
8762
8781
[` kqueue (2 )` ]: https://www.freebsd.org/cgi/man.cgi?query=kqueue&sektion=2
8782
+ [` using` ]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/using
8763
8783
[` util .promisify ()` ]: util.md#utilpromisifyoriginal
8764
8784
[bigints]: https://tc39.github.io/proposal-bigint
8765
8785
[caveats]: #caveats
0 commit comments