fs: improve argument handling for ReadStream
Improve handling of erratic arguments in fs.ReadStream
Refs: https://github.com/nodejs/node/pull/19732
For the uninitiated, a summary of what I'm planning to change:
Type | Current Behavior | Proposed Behavior |
---|---|---|
undefined |
(0, Infinity ) |
(0, Infinity ) |
Anything other than Number
|
ERR_INVALID_ARG_TYPE |
ERR_INVALID_ARG_TYPE |
NaN |
ERR_INVALID_ARG_TYPE |
ERR_OUT_OF_RANGE |
Negative Number s |
✘ | ERR_OUT_OF_RANGE |
Fractional Number s |
✘ | Math.round |
Integers | Work Perfectly | Still work perfectly |
Invalid Arguments | ERR_OUT_OF_RANGE |
ERR_OUT_OF_RANGE |
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
documentation is changed or added -
commit message follows commit guidelines
cc @addaleax @anliting @nodejs/fs