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 @@ -1997,7 +1997,8 @@ function ReadStream(path, options) {
19971997 this . flags = options . flags === undefined ? 'r' : options . flags ;
19981998 this . mode = options . mode === undefined ? 0o666 : options . mode ;
19991999
2000- this . start = options . start ;
2000+ this . start = typeof this . fd !== 'number' && options . start === undefined ?
2001+ 0 : options . start ;
20012002 this . end = options . end ;
20022003 this . autoClose = options . autoClose === undefined ? true : options . autoClose ;
20032004 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