Skip to content

Function: readTerminatedUtf8() ​

ts
function readTerminatedUtf8(cursor): string;

Defined in: cursor/readTerminatedUtf8.ts:19

Reads UTF-8 text that ends at a null byte.

The function reads to the first null byte and moves the cursor past that byte. With no null byte, the function reads to cursor.end and throws no error.

Parameters ​

cursor ​

IsoBoxReadCursor<IsoInt64>

The cursor to read from.

Returns ​

string

The text, with no null byte.

Example ​

ts
const cursor = cursorOf([0x61, 0x00, 0x62, 0x00])
const first = readTerminatedUtf8(cursor) // 'a', and cursor.pos is 2

A Streaming Video Technology Alliance project.