1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-01 16:51:13 -05:00

docs(cli/dts): use one code block per truncate example (#10494)

This commit is contained in:
Casper Beyer 2021-05-05 11:45:10 +08:00 committed by GitHub
parent 89b61b5d05
commit 820c658ff8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2365,7 +2365,9 @@ declare namespace Deno {
* // truncate the entire file * // truncate the entire file
* const file = Deno.openSync("my_file.txt", { read: true, write: true, truncate: true, create: true }); * const file = Deno.openSync("my_file.txt", { read: true, write: true, truncate: true, create: true });
* Deno.ftruncateSync(file.rid); * Deno.ftruncateSync(file.rid);
* ```
* *
* ```ts
* // truncate part of the file * // truncate part of the file
* const file = Deno.openSync("my_file.txt", { read: true, write: true, create: true }); * const file = Deno.openSync("my_file.txt", { read: true, write: true, create: true });
* Deno.writeSync(file.rid, new TextEncoder().encode("Hello World")); * Deno.writeSync(file.rid, new TextEncoder().encode("Hello World"));
@ -2391,7 +2393,9 @@ declare namespace Deno {
* // truncate the entire file * // truncate the entire file
* const file = Deno.open("my_file.txt", { read: true, write: true, create: true }); * const file = Deno.open("my_file.txt", { read: true, write: true, create: true });
* await Deno.ftruncate(file.rid); * await Deno.ftruncate(file.rid);
* ```
* *
* ```ts
* // truncate part of the file * // truncate part of the file
* const file = Deno.open("my_file.txt", { read: true, write: true, create: true }); * const file = Deno.open("my_file.txt", { read: true, write: true, create: true });
* await Deno.write(file.rid, new TextEncoder().encode("Hello World")); * await Deno.write(file.rid, new TextEncoder().encode("Hello World"));