export class RiffReader{constructor(t){this.reader=t,this.pos=0,this.littleEndian=!0}readBytes(t){const{view:e,offset:s}=this.reader.getViewAndOffset(this.pos,this.pos+t);return this.pos+=t,new Uint8Array(e.buffer,s,t)}readU16(){const{view:t,offset:e}=this.reader.getViewAndOffset(this.pos,this.pos+2);return this.pos+=2,t.getUint16(e,this.littleEndian)}readU32(){const{view:t,offset:e}=this.reader.getViewAndOffset(this.pos,this.pos+4);return this.pos+=4,t.getUint32(e,this.littleEndian)}readU64(){let t,e;return this.littleEndian?(t=this.readU32(),e=this.readU32()):(e=this.readU32(),t=this.readU32()),e*4294967296+t}readAscii(t){const{view:e,offset:s}=this.reader.getViewAndOffset(this.pos,this.pos+t);this.pos+=t;let r="";for(let i=0;i<t;i++)r+=String.fromCharCode(e.getUint8(s+i));return r}}
