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.writeAll[Sync]() #25407

Merged
merged 1 commit into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
23 changes: 0 additions & 23 deletions cli/tsc/dts/lib.deno.ns.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2993,29 +2993,6 @@ declare namespace Deno {
*/
export function readAllSync(r: ReaderSync): Uint8Array;

/**
* Write all the content of the array buffer (`arr`) to the writer (`w`).
*
* @deprecated This will be removed in Deno 2.0. See the
* {@link https://docs.deno.com/runtime/manual/advanced/migrate_deprecations | Deno 1.x to 2.x Migration Guide}
* for migration instructions.
*
* @category I/O
*/
export function writeAll(w: Writer, arr: Uint8Array): Promise<void>;

/**
* Synchronously write all the content of the array buffer (`arr`) to the
* writer (`w`).
*
* @deprecated This will be removed in Deno 2.0. See the
* {@link https://docs.deno.com/runtime/manual/advanced/migrate_deprecations | Deno 1.x to 2.x Migration Guide}
* for migration instructions.
*
* @category I/O
*/
export function writeAllSync(w: WriterSync, arr: Uint8Array): void;

/**
* Options which can be set when using {@linkcode Deno.mkdir} and
* {@linkcode Deno.mkdirSync}.
Expand Down
26 changes: 1 addition & 25 deletions runtime/js/13_buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,28 +256,4 @@ function readAllSync(r) {
return buf.bytes();
}

async function writeAll(w, arr) {
internals.warnOnDeprecatedApi(
"Deno.writeAll()",
new Error().stack,
"Use `writeAll()` from `https://jsr.io/@std/io/doc/write-all/~` instead.",
);
let nwritten = 0;
while (nwritten < arr.length) {
nwritten += await w.write(TypedArrayPrototypeSubarray(arr, nwritten));
}
}

function writeAllSync(w, arr) {
internals.warnOnDeprecatedApi(
"Deno.writeAllSync()",
new Error().stack,
"Use `writeAllSync()` from `https://jsr.io/@std/io/doc/write-all/~` instead.",
);
let nwritten = 0;
while (nwritten < arr.length) {
nwritten += w.writeSync(TypedArrayPrototypeSubarray(arr, nwritten));
}
}

export { Buffer, readAll, readAllSync, writeAll, writeAllSync };
export { Buffer, readAll, readAllSync };
2 changes: 0 additions & 2 deletions runtime/js/90_deno_ns.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,6 @@ const denoNs = {
Buffer: buffer.Buffer,
readAll: buffer.readAll,
readAllSync: buffer.readAllSync,
writeAll: buffer.writeAll,
writeAllSync: buffer.writeAllSync,
copy: io.copy,
SeekMode: io.SeekMode,
read(rid, buffer) {
Expand Down
4 changes: 0 additions & 4 deletions runtime/js/99_main.js
Original file line number Diff line number Diff line change
Expand Up @@ -815,8 +815,6 @@ function bootstrapMainRuntime(runtimeOptions, warmup = false) {
delete Deno.readSync;
delete Deno.seek;
delete Deno.seekSync;
delete Deno.writeAll;
delete Deno.writeAllSync;
delete Deno.write;
delete Deno.writeSync;
}
Expand Down Expand Up @@ -992,8 +990,6 @@ function bootstrapWorkerRuntime(
delete Deno.readSync;
delete Deno.seek;
delete Deno.seekSync;
delete Deno.writeAll;
delete Deno.writeAllSync;
delete Deno.write;
delete Deno.writeSync;
}
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 @@ -17,8 +17,6 @@ console.log("Deno.read is", Deno.read);
console.log("Deno.readSync is", Deno.readSync);
console.log("Deno.seek is", Deno.seek);
console.log("Deno.seekSync is", Deno.seekSync);
console.log("Deno.writeAll is", Deno.writeAll);
console.log("Deno.writeAllSync is", Deno.writeAllSync);
console.log("Deno.write is", Deno.write);
console.log("Deno.writeSync is", Deno.writeSync);

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 @@ -14,8 +14,6 @@ Deno.read is undefined
Deno.readSync is undefined
Deno.seek is undefined
Deno.seekSync is undefined
Deno.writeAll is undefined
Deno.writeAllSync is undefined
Deno.write is undefined
Deno.writeSync is undefined
Deno.Listener.prototype.rid is undefined
Expand Down
24 changes: 0 additions & 24 deletions tests/unit/buffer_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -376,30 +376,6 @@ Deno.test({ ignore: DENO_FUTURE }, function testReadAllSync() {
}
});

Deno.test({ ignore: DENO_FUTURE }, async function testWriteAll() {
init();
assert(testBytes);
const writer = new Deno.Buffer();
await Deno.writeAll(writer, testBytes);
const actualBytes = writer.bytes();
assertEquals(testBytes.byteLength, actualBytes.byteLength);
for (let i = 0; i < testBytes.length; ++i) {
assertEquals(testBytes[i], actualBytes[i]);
}
});

Deno.test({ ignore: DENO_FUTURE }, function testWriteAllSync() {
init();
assert(testBytes);
const writer = new Deno.Buffer();
Deno.writeAllSync(writer, testBytes);
const actualBytes = writer.bytes();
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 }];
Expand Down