aboutsummaryrefslogtreecommitdiff
path: root/src/js/node/fs.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/js/node/fs.js')
-rw-r--r--src/js/node/fs.js8
1 files changed, 4 insertions, 4 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);