Skip to content

Commit 6319ce9

Browse files
committed
Small fixes
1 parent 45bc12b commit 6319ce9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/parse-chunked.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,8 @@ function createChunkParser() {
273273
if ((seqLength !== 4 && byte >> 3 === 0b11110) ||
274274
(seqLength !== 3 && byte >> 4 === 0b1110) ||
275275
(seqLength !== 2 && byte >> 5 === 0b110)) {
276-
pendingByteSeq = chunk.slice(chunk.length - seqLength);
277-
chunk = chunk.slice(0, -seqLength);
276+
pendingByteSeq = chunk.slice(chunk.length - seqLength); // use slice to avoid tying chunk
277+
chunk = chunk.subarray(0, -seqLength); // use subarray to avoid buffer copy
278278
}
279279

280280
break;

0 commit comments

Comments
 (0)