diff options
author | Kevin (Kun) "Kassimo" Qian <kevinkassimo@gmail.com> | 2020-02-18 11:45:59 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-18 14:45:59 -0500 |
commit | 08dcf6bff73bbe579769ccd0f135ed4af919ea48 (patch) | |
tree | 50edb7b33b9063b4e79c73ed62da68dfaabf9356 /cli/js/lib.deno.ns.d.ts | |
parent | f0f807c524f76bbf91c31f13f79d60a272e1fe3f (diff) |
feat: Deno.makeTempFile (#4024)
Diffstat (limited to 'cli/js/lib.deno.ns.d.ts')
-rw-r--r-- | cli/js/lib.deno.ns.d.ts | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/cli/js/lib.deno.ns.d.ts b/cli/js/lib.deno.ns.d.ts index b96e108c3..12e8ae4ba 100644 --- a/cli/js/lib.deno.ns.d.ts +++ b/cli/js/lib.deno.ns.d.ts @@ -680,9 +680,9 @@ declare namespace Deno { mode?: number ): Promise<void>; - // @url js/make_temp_dir.d.ts + // @url js/make_temp.d.ts - export interface MakeTempDirOptions { + export interface MakeTempOptions { dir?: string; prefix?: string; suffix?: string; @@ -696,7 +696,7 @@ declare namespace Deno { * Requires allow-write. */ // TODO(ry) Doesn't check permissions. - export function makeTempDirSync(options?: MakeTempDirOptions): string; + export function makeTempDirSync(options?: MakeTempOptions): string; /** makeTempDir creates a new temporary directory in the directory `dir`, its * name beginning with `prefix` and ending with `suffix`. @@ -712,7 +712,27 @@ declare namespace Deno { * Requires allow-write. */ // TODO(ry) Doesn't check permissions. - export function makeTempDir(options?: MakeTempDirOptions): Promise<string>; + export function makeTempDir(options?: MakeTempOptions): Promise<string>; + + /** makeTempFileSync is the synchronous version of `makeTempFile`. + * + * const tempFileName0 = Deno.makeTempFileSync(); + * const tempFileName1 = Deno.makeTempFileSync({ prefix: 'my_temp' }); + */ + export function makeTempFileSync(options?: MakeTempOptions): string; + + /** makeTempFile creates a new temporary file in the directory `dir`, its + * name beginning with `prefix` and ending with `suffix`. + * It returns the full path to the newly created file. + * If `dir` is unspecified, tempFile uses the default directory for temporary + * files. Multiple programs calling tempFile simultaneously will not choose the + * same directory. It is the caller's responsibility to remove the file + * when no longer needed. + * + * const tempFileName0 = await Deno.makeTempFile(); + * const tempFileName1 = await Deno.makeTempFile({ prefix: 'my_temp' }); + */ + export function makeTempFile(options?: MakeTempOptions): Promise<string>; /** Changes the permission of a specific file/directory of specified path * synchronously. |