Options
All
  • Public
  • Public/Protected
  • All
Menu

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`
const reader = BinaryReader.fromArrayBuffer(buffer);
const messageLength = BinaryReader.readInt32(reader);
console.log(messageLength.value); // 11

const message = BinaryReader.readUtf8String(messageLength.value, messageLength);
console.log(message.value); // Hello world

Hierarchy

  • BinaryReader

Index

Properties

Properties

data: DataView
offset: number