summaryrefslogtreecommitdiff
path: root/cli/js/ops/fs/make_temp.ts
blob: cc8a76435e5f825e43036f0fd54259082e15dfe0 (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 await 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 await sendAsync("op_make_temp_file", options);
}