Asynchronously creates a disposable directory in the OS temporary directory that gets deleted after the callback is done or errors.
MIT License
Asynchronously creates a disposable directory in the OS temporary directory that gets deleted after the callback is done or errors.
To install disposable-directory
with npm, run:
npm install disposable-directory
Then, import and use the function disposableDirectory
.
How to use a disposable directory:
import disposableDirectory from "disposable-directory";
disposableDirectory(async (directoryPath) => {
// Use the directory here.
})
.then(() => {
// The directory is gone.
})
.catch(() => {
// The directory is gone.
});
Supported operating systems:
Supported runtime environments:
^14.17.0 || ^16.0.0 || >= 18.0.0
.Projects must configure TypeScript to use types from the ECMAScript modules that have a // @ts-check
comment:
compilerOptions.allowJs
should be true
.compilerOptions.maxNodeModuleJsDepth
should be reasonably large, e.g. 10
.compilerOptions.module
should be "node16"
or "nodenext"
.The npm package disposable-directory
features optimal JavaScript module design. These ECMAScript modules are exported via the package.json
field exports
: