Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

翻译: Deno.readFileSync #57

Merged
merged 1 commit into from
Apr 15, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib.deno.ns.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1271,15 +1271,15 @@ declare namespace Deno {
* Requires `allow-read` and `allow-write` permission. */
export function rename(oldpath: string, newpath: string): Promise<void>;

/** Synchronously reads and returns the entire contents of a file as an array
* of bytes. `TextDecoder` can be used to transform the bytes to string if
* required. Reading a directory returns an empty data array.
/** 同步地读取并将文件的全部内容解析为字节数组。
* `TextDecoder` 可以在需要的情况下可以将字节转换成字符串。
* 读取目录返回一个空的数据数组。
*
* const decoder = new TextDecoder("utf-8");
* const data = Deno.readFileSync("hello.txt");
* console.log(decoder.decode(data));
*
* Requires `allow-read` permission. */
* 需要 `allow-read` 权限。 */
export function readFileSync(path: string): Uint8Array;

/** Reads and resolves to the entire contents of a file as an array of bytes.
Expand Down