Skip to content

mkdtemp

mkdtemp(suffix: string, prefix: string, dir?: string): Promise<string>

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

Create a temporary directory and return its path.

Parameters

ParameterTypeDefault valueDescription
suffixstring""Optional suffix for the directory name
prefixstring"tmp"Optional prefix for the directory name (default: “tmp”)
dir?stringundefinedOptional parent directory (default: system temp dir)

Returns

Promise<string>

Promise of path to the created directory

Example

const dir = await mkdtemp("", "myapp-")
// Use directory...
await rm(dir, { recursive: true })