2020-02-18 14:45:59 -05:00
|
|
|
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
2020-07-06 21:45:39 -04:00
|
|
|
|
2020-03-09 19:22:15 -04:00
|
|
|
import { sendSync, sendAsync } from "../dispatch_json.ts";
|
2020-02-18 14:45:59 -05:00
|
|
|
|
|
|
|
export interface MakeTempOptions {
|
|
|
|
dir?: string;
|
|
|
|
prefix?: string;
|
|
|
|
suffix?: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export function makeTempDirSync(options: MakeTempOptions = {}): string {
|
2020-02-25 09:14:27 -05:00
|
|
|
return sendSync("op_make_temp_dir", options);
|
2020-02-18 14:45:59 -05:00
|
|
|
}
|
|
|
|
|
2020-03-20 09:38:34 -04:00
|
|
|
export function makeTempDir(options: MakeTempOptions = {}): Promise<string> {
|
2020-03-16 05:22:16 -04:00
|
|
|
return sendAsync("op_make_temp_dir", options);
|
2020-02-18 14:45:59 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
export function makeTempFileSync(options: MakeTempOptions = {}): string {
|
2020-02-25 09:14:27 -05:00
|
|
|
return sendSync("op_make_temp_file", options);
|
2020-02-18 14:45:59 -05:00
|
|
|
}
|
|
|
|
|
2020-03-20 09:38:34 -04:00
|
|
|
export function makeTempFile(options: MakeTempOptions = {}): Promise<string> {
|
2020-03-16 05:22:16 -04:00
|
|
|
return sendAsync("op_make_temp_file", options);
|
2020-02-18 14:45:59 -05:00
|
|
|
}
|