We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 45bc12b commit 6319ce9Copy full SHA for 6319ce9
src/parse-chunked.js
@@ -273,8 +273,8 @@ function createChunkParser() {
273
if ((seqLength !== 4 && byte >> 3 === 0b11110) ||
274
(seqLength !== 3 && byte >> 4 === 0b1110) ||
275
(seqLength !== 2 && byte >> 5 === 0b110)) {
276
- pendingByteSeq = chunk.slice(chunk.length - seqLength);
277
- chunk = chunk.slice(0, -seqLength);
+ pendingByteSeq = chunk.slice(chunk.length - seqLength); // use slice to avoid tying chunk
+ chunk = chunk.subarray(0, -seqLength); // use subarray to avoid buffer copy
278
}
279
280
break;
0 commit comments