@@ -1183,6 +1183,10 @@ changes: |
1183 | 1183 | Calls `filehandle.close()` and returns a promise that fulfills when the |
1184 | 1184 | filehandle is closed. |
1185 | 1185 |
|
| 1186 | +This method enables the filehandle to be used with [`await using`][], which |
| 1187 | +will automatically close the file when the scope exits. For more information, |
| 1188 | +see the [MDN documentation on `using` statements][`using`]. |
| 1189 | +
|
1186 | 1190 | ### `fsPromises.access(path[, mode])` |
1187 | 1191 |
|
1188 | 1192 | <!-- YAML |
@@ -1665,10 +1669,11 @@ directory cannot be deleted, disposal will throw an error. The object has an |
1665 | 1669 | async `remove()` method which will perform the same task. |
1666 | 1670 |
|
1667 | 1671 | Both this function and the disposal function on the resulting object are |
1668 | | -async, so it should be used with `await` + `await using` as in |
| 1672 | +async, so it should be used with `await` + [`await using`][] as in |
1669 | 1673 | `await using dir = await fsPromises.mkdtempDisposable('prefix')`. |
1670 | 1674 |
|
1671 | | -<!-- TODO: link MDN docs for disposables once https://github.com/mdn/content/pull/38027 lands --> |
| 1675 | +See the [MDN documentation on `using` statements][`using`] for more information about |
| 1676 | +explicit resource management. |
1672 | 1677 |
|
1673 | 1678 | For detailed information, see the documentation of [`fsPromises.mkdtemp()`][]. |
1674 | 1679 |
|
@@ -6417,12 +6422,13 @@ removed if it still exists. If the directory cannot be deleted, disposal will |
6417 | 6422 | throw an error. The object has a `remove()` method which will perform the same |
6418 | 6423 | task. |
6419 | 6424 |
|
6420 | | -<!-- TODO: link MDN docs for disposables once https://github.com/mdn/content/pull/38027 lands --> |
| 6425 | +See the [MDN documentation on `using` statements][`using`] for more information about |
| 6426 | +explicit resource management. |
6421 | 6427 |
|
6422 | 6428 | For detailed information, see the documentation of [`fs.mkdtemp()`][]. |
6423 | 6429 |
|
6424 | 6430 | There is no callback-based version of this API because it is designed for use |
6425 | | -with the `using` syntax. |
| 6431 | +with the [`using`][] syntax. |
6426 | 6432 |
|
6427 | 6433 | The optional `options` argument can be a string specifying an encoding, or an |
6428 | 6434 | object with an `encoding` property specifying the character encoding to use. |
@@ -7294,6 +7300,10 @@ changes: |
7294 | 7300 | Calls `dir.close()` if the directory handle is open, and returns a promise that |
7295 | 7301 | fulfills when disposal is complete. |
7296 | 7302 |
|
| 7303 | +This method enables the directory to be used with [`await using`][], which |
| 7304 | +will automatically close the directory when the scope exits. For more |
| 7305 | +information, see the [MDN documentation on `using` statements][`using`]. |
| 7306 | +
|
7297 | 7307 | #### `dir[Symbol.dispose]()` |
7298 | 7308 |
|
7299 | 7309 | <!-- YAML |
@@ -7309,6 +7319,10 @@ changes: |
7309 | 7319 | Calls `dir.closeSync()` if the directory handle is open, and returns |
7310 | 7320 | `undefined`. |
7311 | 7321 |
|
| 7322 | +This method enables the directory to be used with [`using`][], which |
| 7323 | +will automatically close the directory when the scope exits. For more |
| 7324 | +information, see the [MDN documentation on `using` statements][`using`]. |
| 7325 | +
|
7312 | 7326 | ### Class: `fs.Dirent` |
7313 | 7327 |
|
7314 | 7328 | <!-- YAML |
@@ -8443,6 +8457,10 @@ the `data` argument must be a {Buffer}. |
8443 | 8457 |
|
8444 | 8458 | Calls `utf8Stream.destroy()`. |
8445 | 8459 |
|
| 8460 | +This method enables the stream to be used with [`using`][], which |
| 8461 | +will automatically destroy the stream when the scope exits. For more |
| 8462 | +information, see the [MDN documentation on `using` statements][`using`]. |
| 8463 | +
|
8446 | 8464 | ### Class: `fs.WriteStream` |
8447 | 8465 |
|
8448 | 8466 | <!-- YAML |
@@ -9259,6 +9277,7 @@ the file contents. |
9259 | 9277 | [`Number.MAX_SAFE_INTEGER`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER |
9260 | 9278 | [`ReadDirectoryChangesW`]: https://docs.microsoft.com/en-us/windows/desktop/api/winbase/nf-winbase-readdirectorychangesw |
9261 | 9279 | [`UV_THREADPOOL_SIZE`]: cli.md#uv_threadpool_sizesize |
| 9280 | +[`await using`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/await_using |
9262 | 9281 | [`event ports`]: https://illumos.org/man/port_create |
9263 | 9282 | [`filehandle.createReadStream()`]: #filehandlecreatereadstreamoptions |
9264 | 9283 | [`filehandle.createWriteStream()`]: #filehandlecreatewritestreamoptions |
@@ -9318,6 +9337,7 @@ the file contents. |
9318 | 9337 | [`stream/iter pipeTo()`]: stream_iter.md#pipetosource-transforms-writer-options |
9319 | 9338 | [`stream/iter pull()`]: stream_iter.md#pullsource-transforms-options |
9320 | 9339 | [`stream/iter pullSync()`]: stream_iter.md#pullsyncsource-transforms |
| 9340 | +[`using`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/using |
9321 | 9341 | [`util.promisify()`]: util.md#utilpromisifyoriginal |
9322 | 9342 | [bigints]: https://tc39.github.io/proposal-bigint |
9323 | 9343 | [caveats]: #caveats |
|