Skip to content
Permalink
Browse files

stream: improve read() performance more

PR-URL: #28989
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
  • Loading branch information...
mscdex authored and targos committed Aug 6, 2019
1 parent a4e2549 commit 6bc4620d8b83e401c8cafe16719492ee88e44571
Showing with 4 additions and 1 deletion.
  1. +4 −1 lib/internal/streams/buffer_list.js
@@ -139,7 +139,10 @@ module.exports = class BufferList {
while (p = p.next) {
const buf = p.data;
const nb = (n > buf.length ? buf.length : n);
buf.copy(ret, ret.length - n, 0, nb);
if (nb === buf.length)
ret.set(buf, ret.length - n);
else
ret.set(new Uint8Array(buf.buffer, buf.byteOffset, nb), ret.length - n);
n -= nb;
if (n === 0) {
if (nb === buf.length) {

0 comments on commit 6bc4620

Please sign in to comment.
You can’t perform that action at this time.