1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-25 15:29:32 -05:00

fix example of readTextFile (#5247)

This commit is contained in:
A.E Clarence 2020-05-12 17:38:44 +00:00 committed by GitHub
parent 053c568c8c
commit e90c95b465
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1031,9 +1031,8 @@ declare namespace Deno {
/** Asynchronously reads and returns the entire contents of a file as a utf8
* encoded string. Reading a directory returns an empty data array.
*
* const decoder = new TextDecoder("utf-8");
* const data = Deno.readFileSync("hello.txt");
* console.log(decoder.decode(data));
* const data = await Deno.readTextFile("hello.txt");
* console.log(data);
*
* Requires `allow-read` permission. */
export function readTextFile(path: string): Promise<string>;