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

chore(ext/io): remove use of deprecated Deno.writeSync() (#22872)

This commit is contained in:
Asher Gomez 2024-03-21 04:39:25 +11:00 committed by GitHub
parent d66154d42a
commit 9593cf2852
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 8 additions and 8 deletions

View file

@ -55,7 +55,7 @@ Deno.bench("b64_rt_short", { n: 1e6 }, () => {
const dataChunk = new Uint8Array(100); const dataChunk = new Uint8Array(100);
const file = Deno.openSync("/dev/null", { write: true }); const file = Deno.openSync("/dev/null", { write: true });
Deno.bench("write_null", { n: 5e5 }, () => { Deno.bench("write_null", { n: 5e5 }, () => {
Deno.writeSync(file.rid, dataChunk); file.writeSync(dataChunk);
}); });
} }

View file

@ -2141,7 +2141,7 @@ declare namespace Deno {
* "hello.txt", * "hello.txt",
* { read: true, write: true, truncate: true, create: true }, * { read: true, write: true, truncate: true, create: true },
* ); * );
* Deno.writeSync(file.rid, new TextEncoder().encode("Hello world")); * file.writeSync(new TextEncoder().encode("Hello world"));
* *
* // advance cursor 6 bytes * // advance cursor 6 bytes
* const cursorPosition = Deno.seekSync(file.rid, 6, Deno.SeekMode.Start); * const cursorPosition = Deno.seekSync(file.rid, 6, Deno.SeekMode.Start);
@ -2159,7 +2159,7 @@ declare namespace Deno {
* "hello.txt", * "hello.txt",
* { read: true, write: true, truncate: true, create: true }, * { read: true, write: true, truncate: true, create: true },
* ); * );
* Deno.writeSync(file.rid, new TextEncoder().encode("Hello world")); * file.writeSync(new TextEncoder().encode("Hello world"));
* *
* // Seek 6 bytes from the start of the file * // Seek 6 bytes from the start of the file
* console.log(Deno.seekSync(file.rid, 6, Deno.SeekMode.Start)); // "6" * console.log(Deno.seekSync(file.rid, 6, Deno.SeekMode.Start)); // "6"
@ -2209,7 +2209,7 @@ declare namespace Deno {
* "my_file.txt", * "my_file.txt",
* { read: true, write: true, create: true }, * { read: true, write: true, create: true },
* ); * );
* Deno.writeSync(file.rid, new TextEncoder().encode("Hello World")); * file.writeSync(new TextEncoder().encode("Hello World"));
* file.truncateSync(1); * file.truncateSync(1);
* Deno.fsyncSync(file.rid); * Deno.fsyncSync(file.rid);
* console.log(Deno.readTextFileSync("my_file.txt")); // H * console.log(Deno.readTextFileSync("my_file.txt")); // H
@ -2244,7 +2244,7 @@ declare namespace Deno {
* "my_file.txt", * "my_file.txt",
* { read: true, write: true, create: true }, * { read: true, write: true, create: true },
* ); * );
* Deno.writeSync(file.rid, new TextEncoder().encode("Hello World")); * file.writeSync(new TextEncoder().encode("Hello World"));
* Deno.fdatasyncSync(file.rid); * Deno.fdatasyncSync(file.rid);
* console.log(Deno.readTextFileSync("my_file.txt")); // Hello World * console.log(Deno.readTextFileSync("my_file.txt")); // Hello World
* ``` * ```
@ -5471,7 +5471,7 @@ declare namespace Deno {
* "my_file.txt", * "my_file.txt",
* { read: true, write: true, create: true } * { read: true, write: true, create: true }
* ); * );
* Deno.writeSync(file.rid, new TextEncoder().encode("Hello World")); * file.writeSync(new TextEncoder().encode("Hello World"));
* Deno.ftruncateSync(file.rid, 7); * Deno.ftruncateSync(file.rid, 7);
* Deno.seekSync(file.rid, 0, Deno.SeekMode.Start); * Deno.seekSync(file.rid, 0, Deno.SeekMode.Start);
* const data = new Uint8Array(32); * const data = new Uint8Array(32);

View file

@ -11,7 +11,7 @@ Deno.test(
create: true, create: true,
}); });
const data = new Uint8Array(64); const data = new Uint8Array(64);
Deno.writeSync(file.rid, data); file.writeSync(data);
Deno.fdatasyncSync(file.rid); Deno.fdatasyncSync(file.rid);
Deno.removeSync(filename); Deno.removeSync(filename);
}, },

View file

@ -46,7 +46,7 @@ Deno.test({
create: true, create: true,
}); });
const data = new Uint8Array(64); const data = new Uint8Array(64);
Deno.writeSync(file.rid, data); file.writeSync(data);
try { try {
fdatasyncSync(file.rid); fdatasyncSync(file.rid);