Skip to content

Commit ec8ff67

Browse files
committed
Revert "fs: fix options.end of fs.ReadStream()"
This reverts commit b343cb6. 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. Refs: nodejs#19240 Refs: nodejs#18121
1 parent ce751b1 commit ec8ff67

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
@@ -1950,8 +1950,7 @@ function ReadStream(path, options) {
19501950
this.flags = options.flags === undefined ? 'r' : options.flags;
19511951
this.mode = options.mode === undefined ? 0o666 : options.mode;
19521952

1953-
this.start = typeof this.fd !== 'number' && options.start === undefined ?
1954-
0 : options.start;
1953+
this.start = options.start;
19551954
this.end = options.end;
19561955
this.autoClose = options.autoClose === undefined ? true : options.autoClose;
19571956
this.pos = undefined;

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

-14
Original file line numberDiff line numberDiff line change
@@ -157,20 +157,6 @@ assert.throws(function() {
157157
}));
158158
}
159159

160-
{
161-
// Verify that end works when start is not specified.
162-
const stream = new fs.createReadStream(rangeFile, { end: 1 });
163-
stream.data = '';
164-
165-
stream.on('data', function(chunk) {
166-
stream.data += chunk;
167-
});
168-
169-
stream.on('end', common.mustCall(function() {
170-
assert.strictEqual('xy', stream.data);
171-
}));
172-
}
173-
174160
{
175161
// pause and then resume immediately.
176162
const pauseRes = fs.createReadStream(rangeFile);

0 commit comments

Comments
 (0)