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:
1327
+
* `path` {string} The path of the created directory.
1328
+
* `remove` {AsyncFunction} A function which removes the created directory.
1329
+
* `[Symbol.asyncDispose]` {AsyncFunction} The same as `remove`.
1330
+
1331
+
The resulting Promise holds an async-disposable object whose `path` property
1332
+
holds the created directory path. When the object is disposed, the directory
1333
+
and its contents will be removed asynchronously if it still exists. If the
1334
+
directory cannot be deleted, disposal will throw an error. The object has an
1335
+
async `remove()` method which will perform the same task.
1336
+
1337
+
Both this function and the disposal function on the resulting object are
1338
+
async, so it should be used with `await` + `await using` as in
1339
+
`await using dir =awaitfsPromises.mkdtempDisposable('prefix')`.
1340
+
1341
+
<!-- TODO: link MDN docs for disposables once https://github.com/mdn/content/pull/38027 lands -->
1342
+
1343
+
For detailed information, see the documentation of [`fsPromises.mkdtemp()`][].
1344
+
1345
+
The optional `options` argument can be a string specifying an encoding, or an
1346
+
object with an `encoding` property specifying the character encoding to use.
1347
+
1317
1348
### `fsPromises.open(path, flags[, mode])`
1318
1349
1319
1350
<!-- YAML
@@ -5909,6 +5940,36 @@ this API: [`fs.mkdtemp()`][].
5909
5940
The optional `options` argument can be a string specifying an encoding, or an
5910
5941
object with an `encoding` property specifying the character encoding to use.
5911
5942
5943
+
### `fs.mkdtempDisposableSync(prefix[, options])`
5944
+
5945
+
<!-- YAML
5946
+
added: REPLACEME
5947
+
-->
5948
+
5949
+
* `prefix` {string|Buffer|URL}
5950
+
* `options` {string|Object}
5951
+
* `encoding` {string} **Default:** `'utf8'`
5952
+
* Returns: {Object} A disposable object:
5953
+
* `path` {string} The path of the created directory.
5954
+
* `remove` {Function} A function which removes the created directory.
5955
+
* `[Symbol.dispose]` {Function} The same as `remove`.
5956
+
5957
+
Returns a disposable object whose `path` property holds the created directory
5958
+
path. When the object is disposed, the directory and its contents will be
5959
+
removed if it still exists. If the directory cannot be deleted, disposal will
5960
+
throw an error. The object has a `remove()` method which will perform the same
5961
+
task.
5962
+
5963
+
<!-- TODO: link MDN docs for disposables once https://github.com/mdn/content/pull/38027 lands -->
5964
+
5965
+
For detailed information, see the documentation of [`fs.mkdtemp()`][].
5966
+
5967
+
There is no callback-based version of this API because it is designed for use
5968
+
with the `using` syntax.
5969
+
5970
+
The optional `options` argument can be a string specifying an encoding, or an
5971
+
object with an `encoding` property specifying the character encoding to use.
0 commit comments