@@ -1314,6 +1314,37 @@ characters directly to the `prefix` string. For instance, given a directory
13141314` prefix` must end with a trailing platform-specific path separator
13151315(` require (' node:path' ).sep ` ).
13161316
1317+ ### ` fsPromises .mkdtempDisposable (prefix[, options])`
1318+
1319+ <!-- YAML
1320+ added: REPLACEME
1321+ -->
1322+
1323+ * ` prefix` {string|Buffer|URL}
1324+ * ` options` {string|Object}
1325+ * ` encoding` {string} **Default:** ` ' utf8' `
1326+ * 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 = await fsPromises .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+
13171348### ` fsPromises .open (path, flags[, mode])`
13181349
13191350<!-- YAML
@@ -5909,6 +5940,36 @@ this API: [`fs.mkdtemp()`][].
59095940The optional ` options` argument can be a string specifying an encoding, or an
59105941object with an ` encoding` property specifying the character encoding to use.
59115942
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.
5972+
59125973### ` fs .opendirSync (path[, options])`
59135974
59145975<!-- YAML
@@ -8502,6 +8563,7 @@ the file contents.
85028563[` fs .writev ()` ]: #fswritevfd-buffers-position-callback
85038564[` fsPromises .access ()` ]: #fspromisesaccesspath-mode
85048565[` fsPromises .copyFile ()` ]: #fspromisescopyfilesrc-dest-mode
8566+ [` fsPromises .mkdtemp ()` ]: #fspromisesmkdtempprefix-options
85058567[` fsPromises .open ()` ]: #fspromisesopenpath-flags-mode
85068568[` fsPromises .opendir ()` ]: #fspromisesopendirpath-options
85078569[` fsPromises .rm ()` ]: #fspromisesrmpath-options
0 commit comments