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

BREAKING(buffer): remove Deno.writeAll[Sync]() (#25407)

This commit is contained in:
Asher Gomez 2024-09-04 17:16:48 +10:00 committed by GitHub
parent ce6b675102
commit 072bf5d379
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 1 additions and 82 deletions

View file

@ -2993,29 +2993,6 @@ declare namespace Deno {
*/ */
export function readAllSync(r: ReaderSync): Uint8Array; 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 * Options which can be set when using {@linkcode Deno.mkdir} and
* {@linkcode Deno.mkdirSync}. * {@linkcode Deno.mkdirSync}.

View file

@ -256,28 +256,4 @@ function readAllSync(r) {
return buf.bytes(); return buf.bytes();
} }
async function writeAll(w, arr) { export { Buffer, readAll, readAllSync };
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 };

View file

@ -101,8 +101,6 @@ const denoNs = {
Buffer: buffer.Buffer, Buffer: buffer.Buffer,
readAll: buffer.readAll, readAll: buffer.readAll,
readAllSync: buffer.readAllSync, readAllSync: buffer.readAllSync,
writeAll: buffer.writeAll,
writeAllSync: buffer.writeAllSync,
copy: io.copy, copy: io.copy,
SeekMode: io.SeekMode, SeekMode: io.SeekMode,
read(rid, buffer) { read(rid, buffer) {

View file

@ -813,8 +813,6 @@ function bootstrapMainRuntime(runtimeOptions, warmup = false) {
delete Deno.readSync; delete Deno.readSync;
delete Deno.seek; delete Deno.seek;
delete Deno.seekSync; delete Deno.seekSync;
delete Deno.writeAll;
delete Deno.writeAllSync;
delete Deno.write; delete Deno.write;
delete Deno.writeSync; delete Deno.writeSync;
} }
@ -988,8 +986,6 @@ function bootstrapWorkerRuntime(
delete Deno.readSync; delete Deno.readSync;
delete Deno.seek; delete Deno.seek;
delete Deno.seekSync; delete Deno.seekSync;
delete Deno.writeAll;
delete Deno.writeAllSync;
delete Deno.write; delete Deno.write;
delete Deno.writeSync; delete Deno.writeSync;
} }

View file

@ -15,8 +15,6 @@ console.log("Deno.read is", Deno.read);
console.log("Deno.readSync is", Deno.readSync); console.log("Deno.readSync is", Deno.readSync);
console.log("Deno.seek is", Deno.seek); console.log("Deno.seek is", Deno.seek);
console.log("Deno.seekSync is", Deno.seekSync); 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.write is", Deno.write);
console.log("Deno.writeSync is", Deno.writeSync); console.log("Deno.writeSync is", Deno.writeSync);

View file

@ -12,8 +12,6 @@ Deno.read is undefined
Deno.readSync is undefined Deno.readSync is undefined
Deno.seek is undefined Deno.seek is undefined
Deno.seekSync is undefined Deno.seekSync is undefined
Deno.writeAll is undefined
Deno.writeAllSync is undefined
Deno.write is undefined Deno.write is undefined
Deno.writeSync is undefined Deno.writeSync is undefined
Deno.Listener.prototype.rid is undefined Deno.Listener.prototype.rid is undefined

View file

@ -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() { Deno.test({ ignore: DENO_FUTURE }, function testBufferBytesArrayBufferLength() {
// defaults to copy // defaults to copy
const args = [{}, { copy: undefined }, undefined, { copy: true }]; const args = [{}, { copy: undefined }, undefined, { copy: true }];