Skip to content

Commit d579aed

Browse files
committed
Revert "fs: fix options.end of fs.ReadStream()"
This reverts commit df038ad. Some people were relying on the behavior of this.start being able to be undefined, whereas after the change it is being set to 0. Fixes: nodejs#19240 Refs: nodejs#18121
1 parent fe71f19 commit d579aed

File tree

2 files changed

+1
-16
lines changed

2 files changed

+1
-16
lines changed

lib/fs.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -1919,8 +1919,7 @@ function ReadStream(path, options) {
19191919
this.flags = options.flags === undefined ? 'r' : options.flags;
19201920
this.mode = options.mode === undefined ? 0o666 : options.mode;
19211921

1922-
this.start = typeof this.fd !== 'number' && options.start === undefined ?
1923-
0 : options.start;
1922+
this.start = options.start;
19241923
this.end = options.end;
19251924
this.autoClose = options.autoClose === undefined ? true : options.autoClose;
19261925
this.pos = undefined;

test/parallel/test-fs-read-stream.js

-14
Original file line numberDiff line numberDiff line change
@@ -132,20 +132,6 @@ stream.on('end', function() {
132132
assert.strictEqual('x', stream.data);
133133
});
134134

135-
{
136-
// Verify that end works when start is not specified.
137-
const stream = new fs.createReadStream(rangeFile, { end: 1 });
138-
stream.data = '';
139-
140-
stream.on('data', function(chunk) {
141-
stream.data += chunk;
142-
});
143-
144-
stream.on('end', common.mustCall(function() {
145-
assert.strictEqual('xy', stream.data);
146-
}));
147-
}
148-
149135
// pause and then resume immediately.
150136
const pauseRes = fs.createReadStream(rangeFile);
151137
pauseRes.pause();

0 commit comments

Comments
 (0)