Skip to content

TemporaryDirectory

Defined in: packages/pythonlib/src/tempfile.node.ts:216

A temporary directory that cleans itself up.

Use the static create() method to instantiate (constructors cannot be async).

Example

const tmp = await TemporaryDirectory.create({ prefix: "myapp-" })
// Use tmp.name as directory path...
await tmp.cleanup() // Removes directory and contents

Properties

name

readonly name: string

Defined in: packages/pythonlib/src/tempfile.node.ts:218

The directory path

Methods

cleanup()

cleanup(): Promise<void>

Defined in: packages/pythonlib/src/tempfile.node.ts:241

Remove the temporary directory and its contents.

Returns

Promise<void>


create()

static create(options?: object): Promise<TemporaryDirectory>

Defined in: packages/pythonlib/src/tempfile.node.ts:229

Create a new TemporaryDirectory.

Parameters

ParameterType
options?{ dir?: string; prefix?: string; suffix?: string; }
options.dir?string
options.prefix?string
options.suffix?string

Returns

Promise<TemporaryDirectory>