diff options
author | Nayeem Rahman <nayeemrmn99@gmail.com> | 2020-06-12 20:23:38 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-12 15:23:38 -0400 |
commit | 1fff6f55c3ba98a10018c6d374795e612061e9b6 (patch) | |
tree | 12074b6d44736b11513d857e437f9e30a6bf65a4 /std/io/util.ts | |
parent | 26bf56afdaf16634ffbaa23684faf3a44cc10f62 (diff) |
refactor: Don't destructure the Deno namespace (#6268)
Diffstat (limited to 'std/io/util.ts')
-rw-r--r-- | std/io/util.ts | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/std/io/util.ts b/std/io/util.ts index 47e48a981..22ecb1331 100644 --- a/std/io/util.ts +++ b/std/io/util.ts @@ -1,7 +1,4 @@ // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. -const { mkdir, open } = Deno; -type File = Deno.File; -type Reader = Deno.Reader; import * as path from "../path/mod.ts"; /** @@ -36,13 +33,13 @@ export async function tempFile( prefix?: string; postfix?: string; } = { prefix: "", postfix: "" } -): Promise<{ file: File; filepath: string }> { +): Promise<{ file: Deno.File; filepath: string }> { const r = Math.floor(Math.random() * 1000000); const filepath = path.resolve( `${dir}/${opts.prefix || ""}${r}${opts.postfix || ""}` ); - await mkdir(path.dirname(filepath), { recursive: true }); - const file = await open(filepath, { + await Deno.mkdir(path.dirname(filepath), { recursive: true }); + const file = await Deno.open(filepath, { create: true, read: true, write: true, |