Normalizes an input string or byte array into a Uint8Array.
Uint8Array
If the input is already a Uint8Array, it is returned directly; otherwise, the string is encoded using UTF-8.
The UTF-8 string or Uint8Array to convert.
A Uint8Array representation of the input.
const bytes = toBytes("hello world"); Copy
const bytes = toBytes("hello world");
Normalizes an input string or byte array into a
Uint8Array.If the input is already a
Uint8Array, it is returned directly; otherwise, the string is encoded using UTF-8.