mirror of
https://github.com/denoland/deno.git
synced 2024-12-22 15:24:46 -05:00
chore(ext/io): cleanup unused functions (#21844)
These functions don't appear to be used anywhere.
This commit is contained in:
parent
c2c115ebd8
commit
664ffe2ad0
1 changed files with 0 additions and 53 deletions
|
@ -13,7 +13,6 @@ import {
|
||||||
const {
|
const {
|
||||||
Uint8Array,
|
Uint8Array,
|
||||||
ArrayPrototypePush,
|
ArrayPrototypePush,
|
||||||
MathMin,
|
|
||||||
TypedArrayPrototypeSubarray,
|
TypedArrayPrototypeSubarray,
|
||||||
TypedArrayPrototypeSet,
|
TypedArrayPrototypeSet,
|
||||||
TypedArrayPrototypeGetBuffer,
|
TypedArrayPrototypeGetBuffer,
|
||||||
|
@ -171,56 +170,6 @@ function concatBuffers(buffers) {
|
||||||
return contents;
|
return contents;
|
||||||
}
|
}
|
||||||
|
|
||||||
function readAllSyncSized(r, size) {
|
|
||||||
const buf = new Uint8Array(size + 1); // 1B to detect extended files
|
|
||||||
let cursor = 0;
|
|
||||||
|
|
||||||
while (cursor < size) {
|
|
||||||
const sliceEnd = MathMin(size + 1, cursor + READ_PER_ITER);
|
|
||||||
const slice = TypedArrayPrototypeSubarray(buf, cursor, sliceEnd);
|
|
||||||
const read = r.readSync(slice);
|
|
||||||
if (typeof read == "number") {
|
|
||||||
cursor += read;
|
|
||||||
} else {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handle truncated or extended files during read
|
|
||||||
if (cursor > size) {
|
|
||||||
// Read remaining and concat
|
|
||||||
return concatBuffers([buf, readAllSync(r)]);
|
|
||||||
} else { // cursor == size
|
|
||||||
return TypedArrayPrototypeSubarray(buf, 0, cursor);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function readAllInnerSized(r, size, options) {
|
|
||||||
const buf = new Uint8Array(size + 1); // 1B to detect extended files
|
|
||||||
let cursor = 0;
|
|
||||||
const signal = options?.signal ?? null;
|
|
||||||
while (cursor < size) {
|
|
||||||
signal?.throwIfAborted();
|
|
||||||
const sliceEnd = MathMin(size + 1, cursor + READ_PER_ITER);
|
|
||||||
const slice = TypedArrayPrototypeSubarray(buf, cursor, sliceEnd);
|
|
||||||
const read = await r.read(slice);
|
|
||||||
if (typeof read == "number") {
|
|
||||||
cursor += read;
|
|
||||||
} else {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
signal?.throwIfAborted();
|
|
||||||
|
|
||||||
// Handle truncated or extended files during read
|
|
||||||
if (cursor > size) {
|
|
||||||
// Read remaining and concat
|
|
||||||
return concatBuffers([buf, await readAllInner(r, options)]);
|
|
||||||
} else {
|
|
||||||
return TypedArrayPrototypeSubarray(buf, 0, cursor);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class Stdin {
|
class Stdin {
|
||||||
#readable;
|
#readable;
|
||||||
|
|
||||||
|
@ -327,9 +276,7 @@ export {
|
||||||
read,
|
read,
|
||||||
readAll,
|
readAll,
|
||||||
readAllInner,
|
readAllInner,
|
||||||
readAllInnerSized,
|
|
||||||
readAllSync,
|
readAllSync,
|
||||||
readAllSyncSized,
|
|
||||||
readSync,
|
readSync,
|
||||||
SeekMode,
|
SeekMode,
|
||||||
stderr,
|
stderr,
|
||||||
|
|
Loading…
Reference in a new issue