summaryrefslogtreecommitdiff
path: root/ext/io/12_io.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/io/12_io.js')
-rw-r--r--ext/io/12_io.js53
1 files changed, 0 insertions, 53 deletions
diff --git a/ext/io/12_io.js b/ext/io/12_io.js
index 0621e6479..36cde6020 100644
--- a/ext/io/12_io.js
+++ b/ext/io/12_io.js
@@ -13,7 +13,6 @@ import {
const {
Uint8Array,
ArrayPrototypePush,
- MathMin,
TypedArrayPrototypeSubarray,
TypedArrayPrototypeSet,
TypedArrayPrototypeGetBuffer,
@@ -171,56 +170,6 @@ function concatBuffers(buffers) {
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 {
#readable;
@@ -327,9 +276,7 @@ export {
read,
readAll,
readAllInner,
- readAllInnerSized,
readAllSync,
- readAllSyncSized,
readSync,
SeekMode,
stderr,