Function: readUint16()
ts
function readUint16(cursor): number;Defined in: cursor/readUint16.ts:18
Reads an unsigned integer of 2 bytes.
Parameters
cursor
The cursor to read from. The function moves the cursor past the field.
Returns
number
The value of the field.
Throws
RangeError if the field passes cursor.end.
Example
ts
// The body of an `mfhd` box: version, flags, and sequence_number.
const cursor = createIsoBoxReadCursor(new Uint8Array([0, 0, 0, 0, 0, 0, 0, 7]))
const version = readUint8(cursor) // 0
const flags = readUint24(cursor) // 0
const sequenceNumber = readUint32(cursor) // 7