@altano/disposable-directory
v0.0.2
Published
Create a temporary, disposable directory that automatically gets cleaned up when the function scope exits. Uses the new `Symbol.asyncDispose` APIs
Readme
disposable-directory
Simple utility for getting a disposable, temporary directory in a Node.js-compatible environment. Directory is cleaned up automatically when the function scope exists.
Uses the new Symbol.asyncDispose API and therefore requires Node.js 24+.
Example
async function doSomething() {
// This creates a directory
await using tempDir = await getDisposableDirectory();
// the directory exists for the scope of this function
console.log(tempDir);
// No cleanup is required. The directory will implicitly be deleted when this function exits (or throws an error).
}