Showing with 7 additions and 2 deletions.
  1. +7 −2 lib/_stream_readable.js
@@ -137,8 +137,13 @@ function howMuchToRead(n, state) {
if (state.objectMode)
return n === 0 ? 0 : 1;

if (isNaN(n) || n === null)
return state.length;
if (isNaN(n) || n === null) {
// only flow one buffer at a time
if (state.flowing && state.buffer.length)
return state.buffer[0].length;
else
return state.length;
}

if (n <= 0)
return 0;