Construct new stream. Relatively lightweight, creating a new DataView over the Uint8Array's ArrayBuffer is the heaviest part.
Bytes to read.
Options.
Static ReadonlyBAD_Invalid value for reading a signed 64-bit integer. This will allow all bitflags to still be zero while signalling the error. Effectively NaN for 64-bit bigints.
Static ReadonlydefaultIs truncation allowed?
Truncation allowed.
Set truncation mode. May not turn it off, once it's on.
Have we read all the bytes yet?
True if finished.
Current offset.
Current.
Original bytes.
Original.
If true, truncation is allowed, and this reader has detected truncation.
Truncation state.
Allowed to be set from outside the class if some higher layer wants to stop all further reads. May only be set to true.
When outputting with console.log('%O', this) or at the node REPL,
see the current chunk structure.
Current depth.
Options for writing, generated by util.inpect.
Local copy of util.inspect, so there is no node dependency.
Formatted string.
Get a chunk of the buffer as 8-bit ASCII text. This is only useful for ancient protocols such as DNS. If the top bit is set, you get equivalent Unicode characters, which should be Latin-1.
Advances the current read position by length bytes.
Number of bytes.
String.
Get a chunk of the original buffer.
Advances the current read position by length bytes.
How many bytes?
A subarray of the original buffer, without copying.
Get a half-precision floating point number. On older JS runtimes, uses a local implementation of f16. Returns NaN if truncation is allowed and the packet was truncated.
Advances the current read position by 2 bytes.
Override stream's endianness.
Number.
Get a single-precision floating point number. Returns NaN if truncation is allowed and the packet was truncated.
Advances the current read position by 4 bytes.
Override stream's endianness.
Number.
Get a double-precision floating point number. Returns NaN if truncation is allowed and the packet was truncated.
Advances the current read position by 8 bytes.
Override stream's endianness.
Number.
Get a two-byte signed integer. Advances the current read position by 2 bytes. Returns NaN if truncation is allowed and the packet was truncated.
Override stream's endianness.
Number.
Get a four-byte signed integer. Advances the current read position by 4 bytes. Returns NaN if truncation is allowed and the packet was truncated.
Override stream's endianness.
Number.
Get a eight-byte signed integer. Advances the current read position by 8 bytes. Returns DataViewReader.BAD_I64 if truncation is allowed and the packet was truncated.
Override stream's endianness.
Bigint.
Get a signed byte. Advances the current read position by 1 byte. Returns NaN if truncation is allowed and the packet was truncated.
Number.
Reset to the beginning of the input. Ignores the initial offset, so if you want to restart at the same place, call seek(initialOffset). Sets the truncation state back to false.
Skip some number of bytes without manipulating them.
Number of bytes to skip.
Get a two-byte unsigned integer. Advances the current read position by 2 bytes. Returns NaN if truncation is allowed and the packet was truncated.
Override stream's endianness.
Number.
Get a four-byte unsigned integer. Advances the current read position by 4 bytes. Returns NaN if truncation is allowed and the packet was truncated.
Override stream's endianness.
Number.
Get an eight-byte unsigned integer. Advances the current read position by 8 bytes. Returns -1n if truncation is allowed and the packet was truncated.
Override stream's endianness.
Bigint, since 264 > 253.
Get an unsigned byte. Advances the current read position by 1 byte. Returns NaN if truncation is allowed and the packet was truncated.
Number.
All of the bytes that have not been used yet. If complete, returns an empty array.
Byte array.
Read a number of bytes as a UTF-8 encoded string. Use the ignoreUTF8errors option to avoid throwing exceptions on invalid UTF-8 and get replacement characters instead. However, by default, Postel was wrong.
Advances the current read position by length bytes.
Number of bytes.
Unicode string.
Treat a Uint8Array as a stream to read typed data from, sequentially. Note that this is not an actual ReadableStream in either the nodejs sense or the web sense.