Cleanup comments and internal variables (#4205)

This commit is contained in:
dubiousjim 2020-03-02 10:19:42 -05:00 committed by GitHub
parent 809019dc6e
commit 6cd46fa3ef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 681 additions and 572 deletions

View file

@ -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);