1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-21 21:50:00 -05:00
This commit is contained in:
精武陈真 2020-06-01 21:53:43 +08:00 committed by GitHub
parent 29db4104c4
commit f0ba814a79
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -364,7 +364,7 @@ declare namespace Deno {
*
* ```ts
* let f = Deno.openSync("/etc/passwd");
* for (const chunk of Deno.iterSync(reader)) {
* for (const chunk of Deno.iterSync(f)) {
* console.log(chunk);
* }
* f.close();
@ -509,7 +509,7 @@ declare namespace Deno {
* ```ts
* const encoder = new TextEncoder();
* const data = encoder.encode("Hello world");
* const file = Deno.openSync("/foo/bar.txt");
* const file = Deno.openSync("/foo/bar.txt", {write: true});
* const bytesWritten = Deno.writeSync(file.rid, data); // 11
* Deno.close(file.rid);
* ```
@ -528,7 +528,7 @@ declare namespace Deno {
* ```ts
* const encoder = new TextEncoder();
* const data = encoder.encode("Hello world");
* const file = await Deno.open("/foo/bar.txt");
* const file = await Deno.open("/foo/bar.txt", { write: true });
* const bytesWritten = await Deno.write(file.rid, data); // 11
* Deno.close(file.rid);
* ```
@ -1366,6 +1366,7 @@ declare namespace Deno {
* points to.
*
* ```ts
* import { assert } from "https://deno.land/std/testing/asserts.ts";
* const fileInfo = await Deno.lstat("hello.txt");
* assert(fileInfo.isFile);
* ```
@ -1389,6 +1390,7 @@ declare namespace Deno {
* follow symlinks.
*
* ```ts
* import { assert } from "https://deno.land/std/testing/asserts.ts";
* const fileInfo = await Deno.stat("hello.txt");
* assert(fileInfo.isFile);
* ```
@ -1400,6 +1402,7 @@ declare namespace Deno {
* always follow symlinks.
*
* ```ts
* import { assert } from "https://deno.land/std/testing/asserts.ts";
* const fileInfo = Deno.statSync("hello.txt");
* assert(fileInfo.isFile);
* ```