@@ -1308,6 +1308,37 @@ characters directly to the `prefix` string. For instance, given a directory
13081308` prefix` must end with a trailing platform-specific path separator
13091309(` require (' node:path' ).sep ` ).
13101310
1311+ ### ` fsPromises .mkdtempDisposable (prefix[, options])`
1312+
1313+ <!-- YAML
1314+ added: REPLACEME
1315+ -->
1316+
1317+ * ` prefix` {string|Buffer|URL}
1318+ * ` options` {string|Object}
1319+ * ` encoding` {string} **Default:** ` ' utf8' `
1320+ * Returns: {Promise} Fulfills with a Promise for an async-disposable Object:
1321+ * ` path` {string} The path of the created directory.
1322+ * ` remove` {AsyncFunction} A function which removes the created directory.
1323+ * ` [Symbol .asyncDispose ]` {AsyncFunction} The same as ` remove` .
1324+
1325+ The resulting Promise holds an async-disposable object whose ` path` property
1326+ holds the created directory path. When the object is disposed, the directory
1327+ and its contents will be removed asynchronously if it still exists. If the
1328+ directory cannot be deleted, disposal will throw an error. The object has an
1329+ async ` remove ()` method which will perform the same task.
1330+
1331+ Both this function and the disposal function on the resulting object are
1332+ async, so it should be used with ` await ` + ` await using` as in
1333+ ` await using dir = await fsPromises .mkdtempDisposable (' prefix' )` .
1334+
1335+ <!-- TODO: link MDN docs for disposables once https://github.com/mdn/content/pull/38027 lands -->
1336+
1337+ For detailed information, see the documentation of [` fsPromises .mkdtemp ()` ][].
1338+
1339+ The optional ` options` argument can be a string specifying an encoding, or an
1340+ object with an ` encoding` property specifying the character encoding to use.
1341+
13111342### ` fsPromises .open (path, flags[, mode])`
13121343
13131344<!-- YAML
@@ -5899,6 +5930,36 @@ this API: [`fs.mkdtemp()`][].
58995930The optional ` options` argument can be a string specifying an encoding, or an
59005931object with an ` encoding` property specifying the character encoding to use.
59015932
5933+ ### ` fs .mkdtempDisposableSync (prefix[, options])`
5934+
5935+ <!-- YAML
5936+ added: REPLACEME
5937+ -->
5938+
5939+ * ` prefix` {string|Buffer|URL}
5940+ * ` options` {string|Object}
5941+ * ` encoding` {string} **Default:** ` ' utf8' `
5942+ * Returns: {Object} A disposable object:
5943+ * ` path` {string} The path of the created directory.
5944+ * ` remove` {Function} A function which removes the created directory.
5945+ * ` [Symbol .dispose ]` {Function} The same as ` remove` .
5946+
5947+ Returns a disposable object whose ` path` property holds the created directory
5948+ path. When the object is disposed, the directory and its contents will be
5949+ removed if it still exists. If the directory cannot be deleted, disposal will
5950+ throw an error. The object has a ` remove ()` method which will perform the same
5951+ task.
5952+
5953+ <!-- TODO: link MDN docs for disposables once https://github.com/mdn/content/pull/38027 lands -->
5954+
5955+ For detailed information, see the documentation of [` fs .mkdtemp ()` ][].
5956+
5957+ There is no callback-based version of this API because it is designed for use
5958+ with the ` using` syntax.
5959+
5960+ The optional ` options` argument can be a string specifying an encoding, or an
5961+ object with an ` encoding` property specifying the character encoding to use.
5962+
59025963### ` fs .opendirSync (path[, options])`
59035964
59045965<!-- YAML
@@ -8505,6 +8566,7 @@ the file contents.
85058566[` fs .writev ()` ]: #fswritevfd-buffers-position-callback
85068567[` fsPromises .access ()` ]: #fspromisesaccesspath-mode
85078568[` fsPromises .copyFile ()` ]: #fspromisescopyfilesrc-dest-mode
8569+ [` fsPromises .mkdtemp ()` ]: #fspromisesmkdtempprefix-options
85088570[` fsPromises .open ()` ]: #fspromisesopenpath-flags-mode
85098571[` fsPromises .opendir ()` ]: #fspromisesopendirpath-options
85108572[` fsPromises .rm ()` ]: #fspromisesrmpath-options
0 commit comments