MCPcopy Index your code
hub / github.com/nodejs/node / mkdtempDisposable

Function mkdtempDisposable

lib/internal/fs/promises.js:2040–2071  ·  view source on GitHub ↗
(prefix, options)

Source from the content-addressed store, hash-verified

2038}
2039
2040async function mkdtempDisposable(prefix, options) {
2041 options = getOptions(options);
2042
2043 prefix = getValidatedPath(prefix, 'prefix');
2044 warnOnNonPortableTemplate(prefix);
2045
2046 const cwd = process.cwd();
2047 const path = await PromisePrototypeThen(
2048 binding.mkdtemp(prefix, options.encoding, kUsePromises),
2049 undefined,
2050 handleErrorFromBinding,
2051 );
2052 // Stash the full path in case of process.chdir()
2053 const fullPath = pathModule.resolve(cwd, path);
2054
2055 const remove = async () => {
2056 const rmrf = lazyRimRaf();
2057 await rmrf(fullPath, {
2058 maxRetries: 0,
2059 recursive: true,
2060 retryDelay: 0,
2061 });
2062 };
2063 return {
2064 __proto__: null,
2065 path,
2066 remove,
2067 async [SymbolAsyncDispose]() {
2068 await remove();
2069 },
2070 };
2071}
2072
2073async function writeFile(path, data, options) {
2074 options = getOptions(options, {

Callers

nothing calls this directly

Calls 4

mkdtempMethod · 0.80
getOptionsFunction · 0.70
resolveMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…