Decodes a hexadecimal string to Uint8Array.
Uses native Uint8Array.fromHex if available, otherwise pure JS fallback.
Uint8Array.fromHex
Hexadecimal string.
Decoded Uint8Array.
If the input is not a string.
If length is odd or contains non-hex characters.
1.0.0
const bytes = decodeHex('ff0080');console.log(bytes); // Uint8Array [255, 0, 128] Copy
const bytes = decodeHex('ff0080');console.log(bytes); // Uint8Array [255, 0, 128]
Decodes a hexadecimal string to Uint8Array.
Uses native
Uint8Array.fromHexif available, otherwise pure JS fallback.