diff options
author | dubiousjim <dubiousjim@gmail.com> | 2020-03-02 10:19:42 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-02 10:19:42 -0500 |
commit | 6cd46fa3ef4b12f35a60f1a33c7f038c06b5fc71 (patch) | |
tree | e8ef21a936ebac529a7c8e87681123fbd225ff5f /cli/js/read_file.ts | |
parent | 809019dc6e9a80843affc927fa7a52cd41e76471 (diff) |
Cleanup comments and internal variables (#4205)
Diffstat (limited to 'cli/js/read_file.ts')
-rw-r--r-- | cli/js/read_file.ts | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/cli/js/read_file.ts b/cli/js/read_file.ts index 705720b05..31b0348e6 100644 --- a/cli/js/read_file.ts +++ b/cli/js/read_file.ts @@ -2,12 +2,13 @@ import { open, openSync } from "./files.ts"; import { readAll, readAllSync } from "./buffer.ts"; -/** Read the entire contents of a file synchronously. +/** Reads and returns the entire contents of a file. * * const decoder = new TextDecoder("utf-8"); * const data = Deno.readFileSync("hello.txt"); * console.log(decoder.decode(data)); - */ + * + * Requires `allow-read` permission. */ export function readFileSync(filename: string): Uint8Array { const file = openSync(filename); const contents = readAllSync(file); @@ -15,12 +16,13 @@ export function readFileSync(filename: string): Uint8Array { return contents; } -/** Read the entire contents of a file. +/** Reads and resolves to the entire contents of a file. * * const decoder = new TextDecoder("utf-8"); * const data = await Deno.readFile("hello.txt"); * console.log(decoder.decode(data)); - */ + * + * Requires `allow-read` permission. */ export async function readFile(filename: string): Promise<Uint8Array> { const file = await open(filename); const contents = await readAll(file); |