1.0.2 • Published 1 year ago

@compilets/using-temp-dir v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

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);
}
1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago