diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/js/node/fs.js | 8 | ||||
-rw-r--r-- | src/js/out/modules/node/fs.js | 8 |
2 files changed, 8 insertions, 8 deletions
diff --git a/src/js/node/fs.js b/src/js/node/fs.js index aa03ffc5c..d287809c6 100644 --- a/src/js/node/fs.js +++ b/src/js/node/fs.js @@ -540,15 +540,15 @@ ReadStream = (function (InternalReadStream) { chunk = chunk.slice(-n); var [_, ...rest] = arguments; this.pos = this.bytesRead; - if (this.end && this.bytesRead >= this.end) { - chunk = chunk.slice(0, this.end - this.start); + if (this.end !== undefined && this.bytesRead > this.end) { + chunk = chunk.slice(0, this.end - this.start + 1); } return super.push(chunk, ...rest); } var end = this.end; // This is multi-chunk read case where we go passed the end of the what we want to read in the last chunk - if (end && this.bytesRead >= end) { - chunk = chunk.slice(0, end - currPos); + if (end !== undefined && this.bytesRead > end) { + chunk = chunk.slice(0, end - currPos + 1); var [_, ...rest] = arguments; this.pos = this.bytesRead; return super.push(chunk, ...rest); diff --git a/src/js/out/modules/node/fs.js b/src/js/out/modules/node/fs.js index 720d03134..7bb354dea 100644 --- a/src/js/out/modules/node/fs.js +++ b/src/js/out/modules/node/fs.js @@ -310,13 +310,13 @@ ReadStream = function(InternalReadStream) { var n = this.bytesRead - currPos; chunk = chunk.slice(-n); var [_, ...rest] = arguments; - if (this.pos = this.bytesRead, this.end && this.bytesRead >= this.end) - chunk = chunk.slice(0, this.end - this.start); + if (this.pos = this.bytesRead, this.end !== void 0 && this.bytesRead > this.end) + chunk = chunk.slice(0, this.end - this.start + 1); return super.push(chunk, ...rest); } var end = this.end; - if (end && this.bytesRead >= end) { - chunk = chunk.slice(0, end - currPos); + if (end !== void 0 && this.bytesRead > end) { + chunk = chunk.slice(0, end - currPos + 1); var [_, ...rest] = arguments; return this.pos = this.bytesRead, super.push(chunk, ...rest); } |