Kit
Functions

getUtf8Decoder

getUtf8Decoder(): VariableSizeDecoder<string>

Returns a decoder for UTF-8 strings.

This decoder deserializes UTF-8 encoded strings from a byte array. It reads all available bytes starting from the given offset.

For more details, see getUtf8Codec.

Returns

VariableSizeDecoder<string>

A VariableSizeDecoder<string> for decoding UTF-8 strings.

Example

Decoding a UTF-8 string.

const decoder = getUtf8Decoder();
const value = decoder.decode(new Uint8Array([0x68, 0x65, 0x6c, 0x6c, 0x6f])); // "hello"

See

getUtf8Codec

On this page