fs: adjust `position` validation in reading methods
This PR:
- Adds validation of
position
argument tofilehandle.read()
, same as in cousin methods - Allows bigint position for
filehandle.read()
- Adjusts min number position from
Number.MIN_SAFE_INTEGER
to-1
- Adjusts min bigint position from
-2⁶³
to-1
- Adjusts max bigint position from
2⁶³ - 1
to2⁶³ - 1 - length
- Makes docs a bit more pedantic
Tests are still passing and documented features are still working, but there are potentially breaking changes:
- When user passes an unsafe number or not a number in
filehandle.read()
, an exception is thrown.- Previously: silently read from current position.
- When user passes a safe bigint in
filehandle.read()
, it works.- Previously: silently read from current position.
- When user passes a negative integer (except for
-1
or-1n
which explicitly means current position), an exception is thrown.- Previously: silently read from current position.
- When user passes a bigint close to upper limit (
2⁶³ - 1
), and addinglength
breaks this limit, an exception is thrown.- Previously:
EINVAL
fromread(2)
(platform-dependent)
- Previously: