makeTempDir
import { makeTempDir } from "jsr:@ende/fs/unstable-make-temp-dir";function · experimental · requires --allow-write
async function makeTempDir(options?: MakeTempOptions): Promise<string>Creates a new temporary directory in the default directory for temporary
files, unless dir is specified. Other optional options include
prefixing and suffixing the directory name with prefix and suffix
respectively.
This call resolves to the full path to the newly created directory.
Multiple programs calling this function simultaneously will create different directories. It is the caller's responsibility to remove the directory when no longer needed.
Requires allow-write permission.
options?: MakeTempOptionsThe options specified when creating a temporary directory.
Returns
A promise that resolves to a path to the temporary directory.
Example: Usage
import { makeTempDir } from "@ende/fs/unstable-make-temp-dir";
const tempDirName0 = await makeTempDir(); // e.g. /tmp/2894ea76
const tempDirName1 = await makeTempDir({ prefix: 'my_temp' }); // e.g. /tmp/my_temp339c944d