From 6cd46fa3ef4b12f35a60f1a33c7f038c06b5fc71 Mon Sep 17 00:00:00 2001 From: dubiousjim Date: Mon, 2 Mar 2020 10:19:42 -0500 Subject: Cleanup comments and internal variables (#4205) --- cli/js/read_file.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'cli/js/read_file.ts') 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 { const file = await open(filename); const contents = await readAll(file); -- cgit v1.2.3