utf8ToString Function

Given an array of bytes containing a utf-8 string, convert to a string.

utf8ToString(utf8: Uint8Array): string | undefined

@returns An equivalent string, or undefined if the array does not contain a valid utf-8 string.

@note This function uses Javascript's TextDecoder if supported by the browser; otherwise, it falls back to a less efficient polyfill.

Parameter Type Description
utf8 Uint8Array  

Returns - string | undefined

An equivalent string, or undefined if the array does not contain a valid utf-8 string.

Defined in

Last Updated: 17 December, 2024