Methods

static

decode(value) → String

Decodes the UTF-8 string given as a byte array and returns the decode value.

Parameter

Name Type Optional Description

value

Uint8Array

 

The bytes of the UTF-8 encoded string.

Throws

any

When an invalid byte sequence is encountered the decoder will throw a DOMException or any other error depending on the platform. See TextDecoder.decode() docs for platform specific details.

Returns

String

The decoded version of the given UTF-8 string.

static

encode(value) → Uint8Array

Encode the given string value as UTF-8.

Parameter

Name Type Optional Description

value

String

 

The string to be encoded as UTF-8.

Returns

Uint8Array

The byte array representing the UTF-8 encoded version of the given value.