ethereumjs-monorepo

@ethereumjs/util


@ethereumjs/util / hexToBytes

Function: hexToBytes()

hexToBytes(hex): Uint8Array

Defined in: packages/util/src/bytes.ts:27

Converts a PrefixedHexString to a Uint8Array

Parameters

hex

`0x${string}`

The 0x-prefixed hex string to convert

Returns

Uint8Array

The converted bytes

Throws

If the input is not a valid 0x-prefixed hex string