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

x/xdg/vendor/types/deno.d.ts>Deno.makeTempDir

Determine XDG Base Directory paths (OS/platform portable)
Go to Latest
function Deno.makeTempDir
import { Deno } from "https://deno.land/x/xdg@v10.5.1/vendor/types/deno.d.ts";
const { makeTempDir } = Deno;

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.

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

Requires allow-write permission.

Parameters

optional
options: MakeTempOptions

Returns

Promise<string>