@compilets/using-temp-dir
v1.0.2
Published
Create a temporary directory and remove it on disposition
Downloads
14
Readme
using-temp-dir
Create a temporary directory, and remove it on disposition, with the
using
declaration of TypeScript.
Import
import {tempDir, tempDirSync} from '@compilets/using-temp-dir';
API
interface AsyncTempDir extends AsyncDisposable {
path: string;
}
export declare function tempDir(prefix?: string): Promise<AsyncTempDir>;
interface SyncTempDir extends Disposable {
path: string;
}
export declare function tempDirSync(prefix?: string): SyncTempDir;
Example
import {tempDir, tempDirSync} from '@compilets/using-temp-dir';
{
await using dir = await tempDir();
console.log(dir.path);
}
{
using dir = tempDirSync();
console.log(dir.path);
}