Decode a hexadecimal string into a Uint8Array.
Uint8Array
Hex string to decode (no 0x prefix expected).
0x
The decoded bytes.
Convert hex string to byte array. Uses built-in function, when available.
hexadecimal string to decode
Decoded bytes.
On wrong argument types. TypeError
On wrong argument ranges or values. RangeError
Decode lowercase hexadecimal into bytes.
hexToBytes('cafe0123'); // Uint8Array.from([0xca, 0xfe, 0x01, 0x23]) Copy
hexToBytes('cafe0123'); // Uint8Array.from([0xca, 0xfe, 0x01, 0x23])
Decode a hexadecimal string into a
Uint8Array.Param: hex
Hex string to decode (no
0xprefix expected).Returns
The decoded bytes.