summaryrefslogtreecommitdiff
path: root/std/node/_fs/_fs_readFile.ts
diff options
context:
space:
mode:
authorNayeem Rahman <nayeemrmn99@gmail.com>2020-06-12 20:23:38 +0100
committerGitHub <noreply@github.com>2020-06-12 15:23:38 -0400
commit1fff6f55c3ba98a10018c6d374795e612061e9b6 (patch)
tree12074b6d44736b11513d857e437f9e30a6bf65a4 /std/node/_fs/_fs_readFile.ts
parent26bf56afdaf16634ffbaa23684faf3a44cc10f62 (diff)
refactor: Don't destructure the Deno namespace (#6268)
Diffstat (limited to 'std/node/_fs/_fs_readFile.ts')
-rw-r--r--std/node/_fs/_fs_readFile.ts8
1 files changed, 2 insertions, 6 deletions
diff --git a/std/node/_fs/_fs_readFile.ts b/std/node/_fs/_fs_readFile.ts
index 448045fd2..d4093ff7f 100644
--- a/std/node/_fs/_fs_readFile.ts
+++ b/std/node/_fs/_fs_readFile.ts
@@ -1,13 +1,9 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
-
import { intoCallbackAPIWithIntercept, MaybeEmpty } from "../_utils.ts";
-
import { getEncoding, FileOptions } from "./_fs_common.ts";
import { Buffer } from "../buffer.ts";
import { fromFileUrl } from "../path.ts";
-const { readFile: denoReadFile, readFileSync: denoReadFileSync } = Deno;
-
type ReadFileCallback = (
err: MaybeEmpty<Error>,
data: MaybeEmpty<string | Buffer>
@@ -38,7 +34,7 @@ export function readFile(
const encoding = getEncoding(optOrCallback);
intoCallbackAPIWithIntercept<Uint8Array, string | Buffer>(
- denoReadFile,
+ Deno.readFile,
(data: Uint8Array): string | Buffer => maybeDecode(data, encoding),
cb,
path
@@ -50,5 +46,5 @@ export function readFileSync(
opt?: FileOptions | string
): string | Buffer {
path = path instanceof URL ? fromFileUrl(path) : path;
- return maybeDecode(denoReadFileSync(path), getEncoding(opt));
+ return maybeDecode(Deno.readFileSync(path), getEncoding(opt));
}