toUtf8Bytes
toUtf8Bytes(
data):Uint8Array
Defined in: utils/to-utf8-bytes.ts:15
Converts a string into a UTF-8 Byte Array
Parameters
data
string
the input to be converted to a UTF-8 Byte Array
Returns
Uint8Array
the specified data as a UTF-8 Byte Array
Example
toUtf8Bytes('essential-eth');// Uint8Array { [Iterator] 0: 101, 1: 115, 2: 115, 3: 101, 4: 110, 5: 116, 6: 105, 7: 97, 8: 108, 9: 45, 10: 101, 11: 116, 12: 104 }
toUtf8Bytes('ethereum');// Uint8Array { [Iterator] 0: 101, 1: 116, 2: 104, 3: 101, 4: 114, 5: 101, 6: 117, 7: 109 }