Skip to content

Commit

Permalink
stream: always prefer reading first buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
ronag committed Jan 17, 2024
1 parent 94f824a commit efb8102
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions lib/internal/streams/readable.js
Original file line number Diff line number Diff line change
Expand Up @@ -631,10 +631,7 @@ function howMuchToRead(n, state) {
if ((state[kState] & kObjectMode) !== 0)
return 1;
if (NumberIsNaN(n)) {
// Only flow one buffer at a time.
if ((state[kState] & kFlowing) !== 0 && state.length)
return state.buffer[state.bufferIndex].length;
return state.length;
return state.length > 0 ? state.buffer[state.bufferIndex].length : 0;
}
if (n <= state.length)
return n;
Expand Down

0 comments on commit efb8102

Please sign in to comment.