Skip to content

Create a temporary directory, and remove it on disposition.

License

Notifications You must be signed in to change notification settings

compilets/using-temp-dir

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Create a temporary directory, and remove it on disposition.

Resources

License

Stars

Watchers

Forks