Skip to content

Function: readBytes() ​

ts
function readBytes(cursor, length): Uint8Array;

Defined in: cursor/readBytes.ts:21

Reads a number of bytes.

The result shares memory with the input. To keep the bytes after the input changes, call slice() on the result.

Parameters ​

cursor ​

IsoBoxReadCursor<IsoInt64>

The cursor to read from. The function moves the cursor past the bytes.

length ​

number

The number of bytes. A length of 0 reads no bytes.

Returns ​

Uint8Array

A view of the bytes.

Throws ​

RangeError if length is negative or the bytes pass cursor.end.

Example ​

ts
const input = new Uint8Array([0x09, 0x01, 0x02, 0x03])
const cursor = createIsoBoxReadCursor(input.subarray(1))
const bytes = readBytes(cursor, 2)

A Streaming Video Technology Alliance project.