Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BREAKING(buffer): remove Deno.readAll[Sync]() #25386

Merged
merged 3 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 1 addition & 23 deletions runtime/js/13_buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,28 +234,6 @@ 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();
}

async function writeAll(w, arr) {
internals.warnOnDeprecatedApi(
"Deno.writeAll()",
Expand All @@ -280,4 +258,4 @@ function writeAllSync(w, arr) {
}
}

export { Buffer, readAll, readAllSync, writeAll, writeAllSync };
export { Buffer, writeAll, writeAllSync };
4 changes: 0 additions & 4 deletions runtime/js/99_main.js
Original file line number Diff line number Diff line change
Expand Up @@ -810,8 +810,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;
Expand Down Expand Up @@ -988,8 +986,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;
Expand Down
2 changes: 0 additions & 2 deletions tests/specs/future/runtime_api/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,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);
Expand Down
2 changes: 0 additions & 2 deletions tests/specs/future/runtime_api/main.out
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ Deno.ftruncateSync 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
Expand Down
22 changes: 0 additions & 22 deletions tests/unit/buffer_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 }, async function testWriteAll() {
init();
assert(testBytes);
Expand Down