with-tmp-dir-promise
Run a promise-based function with a temporary directory, deleting it afterwards.
Requires NodeJS 8+.
Installation
npm install --save with-tmp-dir-promise
Usage example
const WithTempDir = ; ;
WithTempDir documentation
/** * Run the given callback with a newly created temporary directory, * automatically cleaning up once the promise * This function returns a promise that resolves of rejects depending on * A failure in creating the temporary directory causes * immediate rejection without calling the callback. * @param * @param * Also supports cleanupAfter opt: If true, cleanup after resolving/rejecting the returned Promise. * If false (default), cleanup before */ { // ...}