You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Returns: {Promise} Fulfills with a Promise for an async-disposable Object:
1331
+
* `path` {string} The path of the created directory.
1332
+
* `remove` {AsyncFunction} A function which removes the created directory.
1333
+
* `[Symbol.asyncDispose]` {AsyncFunction} The same as `remove`.
1334
+
1335
+
The resulting Promise holds an async-disposable object whose `path` property
1336
+
holds the created directory path. When the object is disposed, the directory
1337
+
and its contents will be removed asynchronously if it still exists. If the
1338
+
directory cannot be deleted, disposal will throw an error. The object has an
1339
+
async `remove()` method which will perform the same task.
1340
+
1341
+
Both this function and the disposal function on the resulting object are
1342
+
async, so it should be used with `await` + `await using` as in
1343
+
`await using dir =awaitfsPromises.mkdtempDisposable('prefix')`.
1344
+
1345
+
<!-- TODO: link MDN docs for disposables once https://github.com/mdn/content/pull/38027 lands -->
1346
+
1347
+
For detailed information, see the documentation of [`fsPromises.mkdtemp()`][].
1348
+
1349
+
The optional `options` argument can be a string specifying an encoding, or an
1350
+
object with an `encoding` property specifying the character encoding to use.
1351
+
1321
1352
### `fsPromises.open(path, flags[, mode])`
1322
1353
1323
1354
<!-- YAML
@@ -5917,6 +5948,36 @@ this API: [`fs.mkdtemp()`][].
5917
5948
The optional `options` argument can be a string specifying an encoding, or an
5918
5949
object with an `encoding` property specifying the character encoding to use.
5919
5950
5951
+
### `fs.mkdtempDisposableSync(prefix[, options])`
5952
+
5953
+
<!-- YAML
5954
+
added: REPLACEME
5955
+
-->
5956
+
5957
+
* `prefix` {string|Buffer|URL}
5958
+
* `options` {string|Object}
5959
+
* `encoding` {string} **Default:** `'utf8'`
5960
+
* Returns: {Object} A disposable object:
5961
+
* `path` {string} The path of the created directory.
5962
+
* `remove` {Function} A function which removes the created directory.
5963
+
* `[Symbol.dispose]` {Function} The same as `remove`.
5964
+
5965
+
Returns a disposable object whose `path` property holds the created directory
5966
+
path. When the object is disposed, the directory and its contents will be
5967
+
removed if it still exists. If the directory cannot be deleted, disposal will
5968
+
throw an error. The object has a `remove()` method which will perform the same
5969
+
task.
5970
+
5971
+
<!-- TODO: link MDN docs for disposables once https://github.com/mdn/content/pull/38027 lands -->
5972
+
5973
+
For detailed information, see the documentation of [`fs.mkdtemp()`][].
5974
+
5975
+
There is no callback-based version of this API because it is designed for use
5976
+
with the `using` syntax.
5977
+
5978
+
The optional `options` argument can be a string specifying an encoding, or an
5979
+
object with an `encoding` property specifying the character encoding to use.
0 commit comments