summaryrefslogtreecommitdiff
path: root/cli/js/ops/fs/make_temp.ts
blob: aeab9afc7acf0bffb4d3a6b2cf87ec62d470ef56 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
import { sendSync, sendAsync } from "../dispatch_json.ts";

export interface MakeTempOptions {
  dir?: string;
  prefix?: string;
  suffix?: string;
}

export function makeTempDirSync(options: MakeTempOptions = {}): string {
  return sendSync("op_make_temp_dir", options);
}

export async function makeTempDir(
  options: MakeTempOptions = {}
): Promise<string> {
  return sendAsync("op_make_temp_dir", options);
}

export function makeTempFileSync(options: MakeTempOptions = {}): string {
  return sendSync("op_make_temp_file", options);
}

export async function makeTempFile(
  options: MakeTempOptions = {}
): Promise<string> {
  return sendAsync("op_make_temp_file", options);
}