diff options
author | Kenta Moriuchi <moriken@kimamass.com> | 2023-04-03 02:41:41 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-02 19:41:41 +0200 |
commit | 03edd48edd004cec091541e6b71095cfbc4b4c87 (patch) | |
tree | 72aed1dae803334b73479ffebc7ca8c83d10addf /ext/io/12_io.js | |
parent | ad8d0c90d1887beb8a5f2c6d30f9dc71cc63e4fe (diff) |
chore: Turn back on dlintPreferPrimordials (#17715)
Closes #17709
Diffstat (limited to 'ext/io/12_io.js')
-rw-r--r-- | ext/io/12_io.js | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/ext/io/12_io.js b/ext/io/12_io.js index e17711735..2a825e7f6 100644 --- a/ext/io/12_io.js +++ b/ext/io/12_io.js @@ -17,6 +17,8 @@ const { MathMin, TypedArrayPrototypeSubarray, TypedArrayPrototypeSet, + TypedArrayPrototypeGetBuffer, + TypedArrayPrototypeGetByteLength, } = primordials; const DEFAULT_BUFFER_SIZE = 32 * 1024; @@ -131,7 +133,10 @@ async function readAllInner(r, options) { const buf = new Uint8Array(READ_PER_ITER); const read = await r.read(buf); if (typeof read == "number") { - ArrayPrototypePush(buffers, new Uint8Array(buf.buffer, 0, read)); + ArrayPrototypePush( + buffers, + new Uint8Array(TypedArrayPrototypeGetBuffer(buf), 0, read), + ); } else { break; } @@ -160,7 +165,7 @@ function readAllSync(r) { function concatBuffers(buffers) { let totalLen = 0; for (let i = 0; i < buffers.length; ++i) { - totalLen += buffers[i].byteLength; + totalLen += TypedArrayPrototypeGetByteLength(buffers[i]); } const contents = new Uint8Array(totalLen); @@ -169,7 +174,7 @@ function concatBuffers(buffers) { for (let i = 0; i < buffers.length; ++i) { const buf = buffers[i]; TypedArrayPrototypeSet(contents, buf, n); - n += buf.byteLength; + n += TypedArrayPrototypeGetByteLength(buf); } return contents; |