mirror of
https://github.com/denoland/deno.git
synced 2025-09-28 13:14:48 +00:00
Cleanup comments and internal variables (#4205)
This commit is contained in:
parent
809019dc6e
commit
6cd46fa3ef
25 changed files with 681 additions and 572 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue