Skip to main content
Version: Next

Variable: utf8ToArray

const utf8ToArray: (str) => Uint8Array = utf8ToUint8Array

Defined in: src/utils/encode.ts:55

Convert utf8-string to Uint8Array

[internal usage]

Parameters

str

string

The UTF-8 string to convert.

Returns

Uint8Array

The encoded Uint8Array.

Example

const myString = 'Hi';
const result = encode.utf8ToArray(myString);
// result = Uint8Array(2) [ 72, 105 ]

Deprecated

use utf8ToUint8Array instead