Skip to content

hexToBytes

hexToBytes(hex): Uint8Array

Defined in: src/Utils.ts:27

Convert a hex string to Uint8Array.

Parameters

hex

string

Hex string (with or without 0x prefix)

Returns

Uint8Array

Uint8Array of bytes

Throws

Error if hex string is invalid

Example

const bytes = Midday.Utils.hexToBytes('deadbeef');

Since

0.2.0