@@ -1318,6 +1318,37 @@ characters directly to the `prefix` string. For instance, given a directory
13181318` prefix` must end with a trailing platform-specific path separator
13191319(` require (' node:path' ).sep ` ).
13201320
1321+ ### ` fsPromises .mkdtempDisposable (prefix[, options])`
1322+
1323+ <!-- YAML
1324+ added: REPLACEME
1325+ -->
1326+
1327+ * ` prefix` {string|Buffer|URL}
1328+ * ` options` {string|Object}
1329+ * ` encoding` {string} **Default:** ` ' utf8' `
1330+ * 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 = await fsPromises .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+
13211352### ` fsPromises .open (path, flags[, mode])`
13221353
13231354<!-- YAML
@@ -5917,6 +5948,36 @@ this API: [`fs.mkdtemp()`][].
59175948The optional ` options` argument can be a string specifying an encoding, or an
59185949object with an ` encoding` property specifying the character encoding to use.
59195950
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.
5980+
59205981### ` fs .opendirSync (path[, options])`
59215982
59225983<!-- YAML
@@ -8511,6 +8572,7 @@ the file contents.
85118572[` fs .writev ()` ]: #fswritevfd-buffers-position-callback
85128573[` fsPromises .access ()` ]: #fspromisesaccesspath-mode
85138574[` fsPromises .copyFile ()` ]: #fspromisescopyfilesrc-dest-mode
8575+ [` fsPromises .mkdtemp ()` ]: #fspromisesmkdtempprefix-options
85148576[` fsPromises .open ()` ]: #fspromisesopenpath-flags-mode
85158577[` fsPromises .opendir ()` ]: #fspromisesopendirpath-options
85168578[` fsPromises .rm ()` ]: #fspromisesrmpath-options
0 commit comments