Skip to content

toUtf8String

toUtf8String(bytes): string

Defined in: utils/to-utf8-string.ts:21

Decode a BytesLike value into a UTF-8 string.

Similar to “toUtf8String” in ethers.js

Parameters

bytes

BytesLike

the bytes to decode

Returns

string

the decoded UTF-8 string

Examples

toUtf8String(new Uint8Array([101, 116, 104]))
// 'eth'
toUtf8String('0x657468')
// 'eth'