File tree 2 files changed +16
-1
lines changed
2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -1997,7 +1997,8 @@ function ReadStream(path, options) {
1997
1997
this . flags = options . flags === undefined ? 'r' : options . flags ;
1998
1998
this . mode = options . mode === undefined ? 0o666 : options . mode ;
1999
1999
2000
- this . start = options . start ;
2000
+ this . start = typeof this . fd !== 'number' && options . start === undefined ?
2001
+ 0 : options . start ;
2001
2002
this . end = options . end ;
2002
2003
this . autoClose = options . autoClose === undefined ? true : options . autoClose ;
2003
2004
this . pos = undefined ;
Original file line number Diff line number Diff line change @@ -164,6 +164,20 @@ common.expectsError(
164
164
} ) ) ;
165
165
}
166
166
167
+ {
168
+ // Verify that end works when start is not specified.
169
+ const stream = new fs . createReadStream ( rangeFile , { end : 1 } ) ;
170
+ stream . data = '' ;
171
+
172
+ stream . on ( 'data' , function ( chunk ) {
173
+ stream . data += chunk ;
174
+ } ) ;
175
+
176
+ stream . on ( 'end' , common . mustCall ( function ( ) {
177
+ assert . strictEqual ( 'xy' , stream . data ) ;
178
+ } ) ) ;
179
+ }
180
+
167
181
{
168
182
// pause and then resume immediately.
169
183
const pauseRes = fs . createReadStream ( rangeFile ) ;
You can’t perform that action at this time.
0 commit comments