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:
parent
ce6b675102
commit
072bf5d379
7 changed files with 1 additions and 82 deletions
23
cli/tsc/dts/lib.deno.ns.d.ts
vendored
23
cli/tsc/dts/lib.deno.ns.d.ts
vendored
|
@ -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}.
|
||||
|
|
|
@ -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 };
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -813,8 +813,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;
|
||||
}
|
||||
|
@ -988,8 +986,6 @@ function bootstrapWorkerRuntime(
|
|||
delete Deno.readSync;
|
||||
delete Deno.seek;
|
||||
delete Deno.seekSync;
|
||||
delete Deno.writeAll;
|
||||
delete Deno.writeAllSync;
|
||||
delete Deno.write;
|
||||
delete Deno.writeSync;
|
||||
}
|
||||
|
|
|
@ -15,8 +15,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);
|
||||
|
||||
|
|
|
@ -12,8 +12,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
|
||||
|
|
|
@ -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 }];
|
||||
|
|
Loading…
Reference in a new issue