Skip to content

Commit bba8729

Browse files
authored
fix: handle Uint8Array byteOffset and byteLength in readSync
1 parent 733705d commit bba8729

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/core/Node.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ export class Node {
193193
if (actualLen + pos > this.buf.length) {
194194
actualLen = this.buf.length - pos;
195195
}
196-
const buf2 = buf instanceof Buffer ? buf : Buffer.from(buf.buffer);
196+
const buf2 = buf instanceof Buffer ? buf : Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);
197197
this.buf.copy(buf2, off, pos, pos + actualLen);
198198
return actualLen;
199199
}

0 commit comments

Comments
 (0)