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

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

Towards #22079

Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
This commit is contained in:
Asher Gomez 2024-09-04 18:54:50 +10:00 committed by GitHub
parent 3d36cbd056
commit 7e11dbb3ac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 1 additions and 53 deletions

View file

@ -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 };

View file

@ -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;

View file

@ -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);

View file

@ -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

View file

@ -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 }];