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

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

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

Creates a new temporary file in the default directory for temporary files, unless dir is specified.

Other options include prefixing and suffixing the directory name with prefix and suffix respectively.

This call resolves to the full path to the newly created file.

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

const tmpFileName0 = await Deno.makeTempFile();  // e.g. /tmp/419e0bf2
const tmpFileName1 = await Deno.makeTempFile({ prefix: 'my_temp' });  // e.g. /tmp/my_temp754d3098

Requires allow-write permission.

Parameters

optional
options: MakeTempOptions

Returns

Promise<string>