Skip to content

Function: tempFolder()

Documentation / @wtf/platform-fs / files / tempFolder

function tempFolder(platform, __namedParameters?): Promise<TempFolder>;

Defined in: packages/platform-fs/src/files.ts:277

Makes a folder of a name of its own in the platform’s temporary folder, dirs.temp: prefix, then a UUID of crypto.randomUUID. It gives its handle and its path, and is removed, with what is in it, by remove() or as await using disposes of it, however the code that holds it ends.

await using folder = await tempFolder(platform, { prefix: 'build-' })
await writeText(platform, platform.path.join(folder.path, 'input.json'), '{}')

Parameters

ParameterType
platformTempFolderPlatform
__namedParameters{ prefix?: string; }
__namedParameters.prefix?string

Returns

Promise<TempFolder>