1.0.2 • Published 2 years ago

@compilets/using-temp-dir v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years 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

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago