From 664ffe2ad0d78865668aee2c94861ff9a2421592 Mon Sep 17 00:00:00 2001 From: Asher Gomez Date: Tue, 9 Jan 2024 00:04:11 +1100 Subject: [PATCH] chore(ext/io): cleanup unused functions (#21844) These functions don't appear to be used anywhere. --- ext/io/12_io.js | 53 ------------------------------------------------- 1 file changed, 53 deletions(-) diff --git a/ext/io/12_io.js b/ext/io/12_io.js index 0621e64794..36cde6020d 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,