From 9593cf2852d83d0629bc97428ac83a962cb2eb09 Mon Sep 17 00:00:00 2001 From: Asher Gomez Date: Thu, 21 Mar 2024 04:39:25 +1100 Subject: [PATCH] chore(ext/io): remove use of deprecated `Deno.writeSync()` (#22872) --- cli/bench/deno_common.js | 2 +- cli/tsc/dts/lib.deno.ns.d.ts | 10 +++++----- tests/unit/sync_test.ts | 2 +- tests/unit_node/_fs/_fs_fdatasync_test.ts | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cli/bench/deno_common.js b/cli/bench/deno_common.js index 7d4ebb37c9..554015c6cd 100644 --- a/cli/bench/deno_common.js +++ b/cli/bench/deno_common.js @@ -55,7 +55,7 @@ Deno.bench("b64_rt_short", { n: 1e6 }, () => { const dataChunk = new Uint8Array(100); const file = Deno.openSync("/dev/null", { write: true }); Deno.bench("write_null", { n: 5e5 }, () => { - Deno.writeSync(file.rid, dataChunk); + file.writeSync(dataChunk); }); } diff --git a/cli/tsc/dts/lib.deno.ns.d.ts b/cli/tsc/dts/lib.deno.ns.d.ts index 787c1a2251..f795c6c172 100644 --- a/cli/tsc/dts/lib.deno.ns.d.ts +++ b/cli/tsc/dts/lib.deno.ns.d.ts @@ -2141,7 +2141,7 @@ declare namespace Deno { * "hello.txt", * { 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 * const cursorPosition = Deno.seekSync(file.rid, 6, Deno.SeekMode.Start); @@ -2159,7 +2159,7 @@ declare namespace Deno { * "hello.txt", * { 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 * console.log(Deno.seekSync(file.rid, 6, Deno.SeekMode.Start)); // "6" @@ -2209,7 +2209,7 @@ declare namespace Deno { * "my_file.txt", * { 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); * Deno.fsyncSync(file.rid); * console.log(Deno.readTextFileSync("my_file.txt")); // H @@ -2244,7 +2244,7 @@ declare namespace Deno { * "my_file.txt", * { 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); * console.log(Deno.readTextFileSync("my_file.txt")); // Hello World * ``` @@ -5471,7 +5471,7 @@ declare namespace Deno { * "my_file.txt", * { 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.seekSync(file.rid, 0, Deno.SeekMode.Start); * const data = new Uint8Array(32); diff --git a/tests/unit/sync_test.ts b/tests/unit/sync_test.ts index 40a8054c00..93eb4f0b08 100644 --- a/tests/unit/sync_test.ts +++ b/tests/unit/sync_test.ts @@ -11,7 +11,7 @@ Deno.test( create: true, }); const data = new Uint8Array(64); - Deno.writeSync(file.rid, data); + file.writeSync(data); Deno.fdatasyncSync(file.rid); Deno.removeSync(filename); }, diff --git a/tests/unit_node/_fs/_fs_fdatasync_test.ts b/tests/unit_node/_fs/_fs_fdatasync_test.ts index 3eabc2fa47..2c054cac35 100644 --- a/tests/unit_node/_fs/_fs_fdatasync_test.ts +++ b/tests/unit_node/_fs/_fs_fdatasync_test.ts @@ -46,7 +46,7 @@ Deno.test({ create: true, }); const data = new Uint8Array(64); - Deno.writeSync(file.rid, data); + file.writeSync(data); try { fdatasyncSync(file.rid);