Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/deno/cli/tsc/dts/lib.deno.ns.d.ts>Deno.makeTempDirSync

A modern runtime for JavaScript and TypeScript.
Go to Latest
function Deno.makeTempDirSync
allow-write
import { Deno } from "https://deno.land/x/deno@v1.28.3/cli/tsc/dts/lib.deno.ns.d.ts";
const { makeTempDirSync } = Deno;

Synchronously 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.

The full path to the newly created directory is returned.

Multiple programs calling this function simultaneously will create different directories. It is the caller's responsibility to remove the directory when no longer needed.

const tempDirName0 = Deno.makeTempDirSync();  // e.g. /tmp/2894ea76
const tempDirName1 = Deno.makeTempDirSync({ prefix: 'my_temp' });  // e.g. /tmp/my_temp339c944d

Requires allow-write permission.

Parameters

optional
options: MakeTempOptions

Returns

string