API reference@evolu/commonBuffer › utf8ToBytes

function utf8ToBytes(
  str: string,
): Uint8Array<ArrayBufferLike> & Uint8Array<ArrayBuffer>;

Defined in: node_modules/@noble/ciphers/utils.d.ts:361

Converts string to bytes using UTF8 encoding.

Throws

On wrong argument types. TypeError

Example

Encodes application text before encryption or MACing.

utf8ToBytes("abc"); // new Uint8Array([97, 98, 99])