// Reads data in little-endian format export default class DataScanner { offset: number; view: DataView; constructor(data: DataView | ArrayBuffer) { this.offset = 0; this.view = data instanceof DataView ? data : new DataView(data); } float32(): number { const x = this.view.getFloat32(this.offset, true); this.offset += 4; return x; } uint8(): number { return this.view.getUint8(this.offset++); } uint32(): number { const x = this.view.getUint32(this.offset, true); this.offset += 4; return x; } }