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:
parent
053c568c8c
commit
e90c95b465
1 changed files with 2 additions and 3 deletions
5
cli/js/lib.deno.ns.d.ts
vendored
5
cli/js/lib.deno.ns.d.ts
vendored
|
@ -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>;
|
||||
|
|
Loading…
Reference in a new issue