summaryrefslogtreecommitdiff
path: root/ext/io/12_io.js
diff options
context:
space:
mode:
authorKenta Moriuchi <moriken@kimamass.com>2023-04-03 02:41:41 +0900
committerGitHub <noreply@github.com>2023-04-02 19:41:41 +0200
commit03edd48edd004cec091541e6b71095cfbc4b4c87 (patch)
tree72aed1dae803334b73479ffebc7ca8c83d10addf /ext/io/12_io.js
parentad8d0c90d1887beb8a5f2c6d30f9dc71cc63e4fe (diff)
chore: Turn back on dlintPreferPrimordials (#17715)
Closes #17709
Diffstat (limited to 'ext/io/12_io.js')
-rw-r--r--ext/io/12_io.js11
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;