A BinaryReader represents a view and offset for iteratively reading data
from an ArrayBuffer.
Readers are created by calling the BinaryReader.fromArrayBuffer() method,
and passed to helper methods such as BinaryReader.readInt32() to read data
from the buffer. These helpers return a new BinaryReader that contains an
adjusted offset and the read value, and can further be passed to additional
helpers.
example
// Reading from an `ArrayBuffer` constreader = BinaryReader.fromArrayBuffer(buffer); constmessageLength = BinaryReader.readInt32(reader); console.log(messageLength.value); // 11
constmessage = BinaryReader.readUtf8String(messageLength.value, messageLength); console.log(message.value); // Hello world
A
BinaryReader
represents a view and offset for iteratively reading data from anArrayBuffer
.Readers are created by calling the
BinaryReader.fromArrayBuffer()
method, and passed to helper methods such asBinaryReader.readInt32()
to read data from the buffer. These helpers return a newBinaryReader
that contains an adjusted offset and the read value, and can further be passed to additional helpers.