diff options
author | Asher Gomez <ashersaupingomez@gmail.com> | 2024-09-04 18:54:50 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-04 08:54:50 +0000 |
commit | 7e11dbb3ac6b3622fc032f1342406603f7a2a9d6 (patch) | |
tree | 4f775cdc6490633443f5a46703e2bda377420569 | |
parent | 3d36cbd056292e0a89d282fa84b7198ae38be4cc (diff) |
BEAKING(buffer): remove `Deno.readAll[Sync]()` (#25386)
Towards #22079
Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
-rw-r--r-- | runtime/js/13_buffer.js | 24 | ||||
-rw-r--r-- | runtime/js/99_main.js | 4 | ||||
-rw-r--r-- | tests/specs/future/runtime_api/main.js | 2 | ||||
-rw-r--r-- | tests/specs/future/runtime_api/main.out | 2 | ||||
-rw-r--r-- | tests/unit/buffer_test.ts | 22 |
5 files changed, 1 insertions, 53 deletions
diff --git a/runtime/js/13_buffer.js b/runtime/js/13_buffer.js index 2dbe5bbf6..4d3f08d4d 100644 --- a/runtime/js/13_buffer.js +++ b/runtime/js/13_buffer.js @@ -234,26 +234,4 @@ class Buffer { } } -async function readAll(r) { - internals.warnOnDeprecatedApi( - "Deno.readAll()", - new Error().stack, - "Use `readAll()` from `https://jsr.io/@std/io/doc/read-all/~` instead.", - ); - const buf = new Buffer(); - await buf.readFrom(r); - return buf.bytes(); -} - -function readAllSync(r) { - internals.warnOnDeprecatedApi( - "Deno.readAllSync()", - new Error().stack, - "Use `readAllSync()` from `https://jsr.io/@std/io/doc/read-all/~` instead.", - ); - const buf = new Buffer(); - buf.readFromSync(r); - return buf.bytes(); -} - -export { Buffer, readAll, readAllSync }; +export { Buffer }; diff --git a/runtime/js/99_main.js b/runtime/js/99_main.js index e2b1559e7..fba264af6 100644 --- a/runtime/js/99_main.js +++ b/runtime/js/99_main.js @@ -805,8 +805,6 @@ function bootstrapMainRuntime(runtimeOptions, warmup = false) { delete Deno.FsFile.prototype.rid; delete Deno.funlock; delete Deno.funlockSync; - delete Deno.readAll; - delete Deno.readAllSync; delete Deno.read; delete Deno.readSync; delete Deno.seek; @@ -976,8 +974,6 @@ function bootstrapWorkerRuntime( delete Deno.FsFile.prototype.rid; delete Deno.funlock; delete Deno.funlockSync; - delete Deno.readAll; - delete Deno.readAllSync; delete Deno.read; delete Deno.readSync; delete Deno.seek; diff --git a/tests/specs/future/runtime_api/main.js b/tests/specs/future/runtime_api/main.js index 9ab96e582..f5e17a6de 100644 --- a/tests/specs/future/runtime_api/main.js +++ b/tests/specs/future/runtime_api/main.js @@ -7,8 +7,6 @@ console.log( ); console.log("Deno.funlock is", Deno.funlock); console.log("Deno.funlockSync is", Deno.funlockSync); -console.log("Deno.readAll is", Deno.readAll); -console.log("Deno.readAllSync is", Deno.readAllSync); console.log("Deno.read is", Deno.read); console.log("Deno.readSync is", Deno.readSync); console.log("Deno.seek is", Deno.seek); diff --git a/tests/specs/future/runtime_api/main.out b/tests/specs/future/runtime_api/main.out index 7cc4cdf15..e76a20265 100644 --- a/tests/specs/future/runtime_api/main.out +++ b/tests/specs/future/runtime_api/main.out @@ -4,8 +4,6 @@ Deno.File is undefined Deno.FsFile.prototype.rid is undefined Deno.funlock is undefined Deno.funlockSync is undefined -Deno.readAll is undefined -Deno.readAllSync is undefined Deno.read is undefined Deno.readSync is undefined Deno.seek is undefined diff --git a/tests/unit/buffer_test.ts b/tests/unit/buffer_test.ts index 5b788a45c..fcbeb4bc9 100644 --- a/tests/unit/buffer_test.ts +++ b/tests/unit/buffer_test.ts @@ -354,28 +354,6 @@ Deno.test({ ignore: DENO_FUTURE }, async function bufferTestGrow() { } }); -Deno.test({ ignore: DENO_FUTURE }, async function testReadAll() { - init(); - assert(testBytes); - const reader = new Deno.Buffer(testBytes.buffer as ArrayBuffer); - const actualBytes = await Deno.readAll(reader); - assertEquals(testBytes.byteLength, actualBytes.byteLength); - for (let i = 0; i < testBytes.length; ++i) { - assertEquals(testBytes[i], actualBytes[i]); - } -}); - -Deno.test({ ignore: DENO_FUTURE }, function testReadAllSync() { - init(); - assert(testBytes); - const reader = new Deno.Buffer(testBytes.buffer as ArrayBuffer); - const actualBytes = Deno.readAllSync(reader); - assertEquals(testBytes.byteLength, actualBytes.byteLength); - for (let i = 0; i < testBytes.length; ++i) { - assertEquals(testBytes[i], actualBytes[i]); - } -}); - Deno.test({ ignore: DENO_FUTURE }, function testBufferBytesArrayBufferLength() { // defaults to copy const args = [{}, { copy: undefined }, undefined, { copy: true }]; |