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

Function mkdtemp

lib/fs.js:3567–3581  ·  view source on GitHub ↗

* Creates a unique temporary directory. * @param {string | Buffer | URL} prefix * @param {string | { encoding?: string; }} [options] * @param {( * err?: Error, * directory?: string * ) => any} callback * @returns {void}

(prefix, options, callback)

Source from the content-addressed store, hash-verified

3565 * @returns {void}
3566 */
3567function mkdtemp(prefix, options, callback) {
3568 callback = makeCallback(typeof options === 'function' ? options : callback);
3569
3570 const h = vfsState.handlers;
3571 if (h !== null && vfsResult(h.mkdtemp(prefix, typeof options === 'function' ? undefined : options), callback)) return;
3572
3573 options = getOptions(options);
3574
3575 prefix = getValidatedPath(prefix, 'prefix');
3576 warnOnNonPortableTemplate(prefix);
3577
3578 const req = new FSReqCallback();
3579 req.oncomplete = callback;
3580 binding.mkdtemp(prefix, options.encoding, req);
3581}
3582
3583/**
3584 * Synchronously creates a unique temporary directory.

Callers 1

doTestFunction · 0.50

Calls 5

vfsResultFunction · 0.85
mkdtempMethod · 0.80
makeCallbackFunction · 0.70
getOptionsFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…