| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 9209cc4 commit 2de1d76
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -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 | |
@@ -1661,10 +1665,11 @@ directory cannot be deleted, disposal will throw an error. The object has an | |||
| 1661 | 1665 | async `remove()` method which will perform the same task. | |
| 1662 | 1666 | ||
| 1663 | 1667 | Both this function and the disposal function on the resulting object are | |
| 1664 | - async, so it should be used with `await` + `await using` as in | ||
| 1668 | + async, so it should be used with `await` + [`await using`][] as in | ||
| 1665 | 1669 | `await using dir = await fsPromises.mkdtempDisposable('prefix')`. | |
| 1666 | 1670 | ||
| 1667 | - <!-- TODO: link MDN docs for disposables once https://github.com/mdn/content/pull/38027 lands --> | ||
| 1671 | + See the [MDN documentation on `using` statements][`using`] for more information about | ||
| 1672 | + explicit resource management. | ||
| 1668 | 1673 | ||
| 1669 | 1674 | For detailed information, see the documentation of [`fsPromises.mkdtemp()`][]. | |
| 1670 | 1675 | ||
@@ -6393,12 +6398,13 @@ removed if it still exists. If the directory cannot be deleted, disposal will | |||
| 6393 | 6398 | throw an error. The object has a `remove()` method which will perform the same | |
| 6394 | 6399 | task. | |
| 6395 | 6400 | ||
| 6396 | - <!-- TODO: link MDN docs for disposables once https://github.com/mdn/content/pull/38027 lands --> | ||
| 6401 | + See the [MDN documentation on `using` statements][`using`] for more information about | ||
| 6402 | + explicit resource management. | ||
| 6397 | 6403 | ||
| 6398 | 6404 | For detailed information, see the documentation of [`fs.mkdtemp()`][]. | |
| 6399 | 6405 | ||
| 6400 | 6406 | There is no callback-based version of this API because it is designed for use | |
| 6401 | - with the `using` syntax. | ||
| 6407 | + with the [`using`][] syntax. | ||
| 6402 | 6408 | ||
| 6403 | 6409 | The optional `options` argument can be a string specifying an encoding, or an | |
| 6404 | 6410 | object with an `encoding` property specifying the character encoding to use. | |
@@ -7273,6 +7279,10 @@ changes: | |||
| 7273 | 7279 | Calls `dir.close()` if the directory handle is open, and returns a promise that | |
| 7274 | 7280 | fulfills when disposal is complete. | |
| 7275 | 7281 | ||
| 7282 | + This method enables the directory to be used with [`await using`][], which | ||
| 7283 | + will automatically close the directory when the scope exits. For more | ||
| 7284 | + information, see the [MDN documentation on `using` statements][`using`]. | ||
| 7285 | + | ||
| 7276 | 7286 | #### `dir[Symbol.dispose]()` | |
| 7277 | 7287 | ||
| 7278 | 7288 | <!-- YAML | |
@@ -7286,6 +7296,10 @@ changes: | |||
| 7286 | 7296 | Calls `dir.closeSync()` if the directory handle is open, and returns | |
| 7287 | 7297 | `undefined`. | |
| 7288 | 7298 | ||
| 7299 | + This method enables the directory to be used with [`using`][], which | ||
| 7300 | + will automatically close the directory when the scope exits. For more | ||
| 7301 | + information, see the [MDN documentation on `using` statements][`using`]. | ||
| 7302 | + | ||
| 7289 | 7303 | ### Class: `fs.Dirent` | |
| 7290 | 7304 | ||
| 7291 | 7305 | <!-- YAML | |
@@ -8397,6 +8411,10 @@ the `data` argument must be a {Buffer}. | |||
| 8397 | 8411 | ||
| 8398 | 8412 | Calls `utf8Stream.destroy()`. | |
| 8399 | 8413 | ||
| 8414 | + This method enables the stream to be used with [`using`][], which | ||
| 8415 | + will automatically destroy the stream when the scope exits. For more | ||
| 8416 | + information, see the [MDN documentation on `using` statements][`using`]. | ||
| 8417 | + | ||
| 8400 | 8418 | ### Class: `fs.WriteStream` | |
| 8401 | 8419 | ||
| 8402 | 8420 | <!-- YAML | |
@@ -9213,6 +9231,7 @@ the file contents. | |||
| 9213 | 9231 | [`Number.MAX_SAFE_INTEGER`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER | |
| 9214 | 9232 | [`ReadDirectoryChangesW`]: https://docs.microsoft.com/en-us/windows/desktop/api/winbase/nf-winbase-readdirectorychangesw | |
| 9215 | 9233 | [`UV_THREADPOOL_SIZE`]: cli.md#uv_threadpool_sizesize | |
| 9234 | + [`await using`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/await_using | ||
| 9216 | 9235 | [`event ports`]: https://illumos.org/man/port_create | |
| 9217 | 9236 | [`filehandle.createReadStream()`]: #filehandlecreatereadstreamoptions | |
| 9218 | 9237 | [`filehandle.createWriteStream()`]: #filehandlecreatewritestreamoptions | |
@@ -9272,6 +9291,7 @@ the file contents. | |||
| 9272 | 9291 | [`stream/iter pipeTo()`]: stream_iter.md#pipetosource-transforms-writer-options | |
| 9273 | 9292 | [`stream/iter pull()`]: stream_iter.md#pullsource-transforms-options | |
| 9274 | 9293 | [`stream/iter pullSync()`]: stream_iter.md#pullsyncsource-transforms | |
| 9294 | + [`using`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/using | ||
| 9275 | 9295 | [`util.promisify()`]: util.md#utilpromisifyoriginal | |
| 9276 | 9296 | [bigints]: https://tc39.github.io/proposal-bigint | |
| 9277 | 9297 | [caveats]: #caveats | |
| Back | FazBrowse Home | New Git URL |
0 commit comments