summaryrefslogtreecommitdiff
path: root/cli/js/ops/fs/make_temp.ts
blob: 85dea5f20998cc745f08639e99061d8bf5e7f6d6 (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
// 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);
}