* Synchronously creates a unique temporary directory. * The returned value is a disposable object which removes the * directory and its contents when disposed. * @param {string | Buffer | URL} prefix * @param {string | { encoding?: string; }} [options] * @returns {object} A disposable object wi
(prefix, options)
| 3609 | * @returns {object} A disposable object with a "path" property. |
| 3610 | */ |
| 3611 | function mkdtempDisposableSync(prefix, options) { |
| 3612 | options = getOptions(options); |
| 3613 | |
| 3614 | prefix = getValidatedPath(prefix, 'prefix'); |
| 3615 | warnOnNonPortableTemplate(prefix); |
| 3616 | |
| 3617 | const path = binding.mkdtemp(prefix, options.encoding); |
| 3618 | // Stash the full path in case of process.chdir() |
| 3619 | const fullPath = pathModule.resolve(process.cwd(), path); |
| 3620 | |
| 3621 | const remove = () => { |
| 3622 | binding.rmSync(fullPath, 0 /* maxRetries */, true /* recursive */, 100 /* retryDelay */); |
| 3623 | }; |
| 3624 | return { |
| 3625 | path, |
| 3626 | remove, |
| 3627 | [SymbolDispose]() { |
| 3628 | remove(); |
| 3629 | }, |
| 3630 | }; |
| 3631 | } |
| 3632 | |
| 3633 | /** |
| 3634 | * Asynchronously copies `src` to `dest`. By |
nothing calls this directly
no test coverage detected
searching dependent graphs…