File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed
Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -2267,7 +2267,8 @@ function ReadStream(path, options) {
22672267 this . flags = options . flags === undefined ? 'r' : options . flags ;
22682268 this . mode = options . mode === undefined ? 0o666 : options . mode ;
22692269
2270- this . start = options . start ;
2270+ this . start = typeof this . fd !== 'number' && options . start === undefined ?
2271+ 0 : options . start ;
22712272 this . end = options . end ;
22722273 this . autoClose = options . autoClose === undefined ? true : options . autoClose ;
22732274 this . pos = undefined ;
Original file line number Diff line number Diff line change @@ -164,6 +164,20 @@ common.expectsError(
164164 } ) ) ;
165165}
166166
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+
167181{
168182 // pause and then resume immediately.
169183 const pauseRes = fs . createReadStream ( rangeFile ) ;
You can’t perform that action at this time.
0 commit comments