* 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)
| 3565 | * @returns {void} |
| 3566 | */ |
| 3567 | function 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. |
no test coverage detected
searching dependent graphs…