@@ -2008,13 +2008,13 @@ function ReadStream(path, options) {
20082008 this . closed = false ;
20092009
20102010 if ( this . start !== undefined ) {
2011- if ( typeof this . start !== 'number' || Number . isNaN ( this . start ) ) {
2012- throw new ERR_INVALID_ARG_TYPE ( 'start' , 'number ' , this . start ) ;
2011+ if ( typeof this . start !== 'number' || ! Number . isInteger ( this . start ) ) {
2012+ throw new ERR_INVALID_ARG_TYPE ( 'start' , 'integer ' , this . start ) ;
20132013 }
20142014 if ( this . end === undefined ) {
20152015 this . end = Infinity ;
2016- } else if ( typeof this . end !== 'number' || Number . isNaN ( this . end ) ) {
2017- throw new ERR_INVALID_ARG_TYPE ( 'end' , 'number ' , this . end ) ;
2016+ } else if ( typeof this . end !== 'number' || ! Number . isInteger ( this . end ) ) {
2017+ throw new ERR_INVALID_ARG_TYPE ( 'end' , 'integer ' , this . end ) ;
20182018 }
20192019
20202020 if ( this . start > this . end ) {
@@ -2028,8 +2028,10 @@ function ReadStream(path, options) {
20282028 // Backwards compatibility: Make sure `end` is a number regardless of `start`.
20292029 // TODO(addaleax): Make the above typecheck not depend on `start` instead.
20302030 // (That is a semver-major change).
2031- if ( typeof this . end !== 'number' || Number . isNaN ( this . end ) )
2031+ if ( typeof this . end !== 'number' )
20322032 this . end = Infinity ;
2033+ else if ( ! Number . isInteger ( this . end ) )
2034+ throw new ERR_INVALID_ARG_TYPE ( 'end' , 'integer' , this . end ) ;
20332035
20342036 if ( typeof this . fd !== 'number' )
20352037 this . open ( ) ;
0 commit comments