summaryrefslogtreecommitdiff
path: root/cli/js/ops/fs/make_temp.ts
blob: 3996744d1aa357e0de09d960498ac715a5119ebc (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
// 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 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 function makeTempFile(options: MakeTempOptions = {}): Promise<string> {
  return sendAsync("op_make_temp_file", options);
}