ethereumjs-monorepo

@ethereumjs/util


@ethereumjs/util / toBytes

Function: toBytes()

toBytes(v): Uint8Array

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

Coerce supported JavaScript values to bytes.

Accepts hex strings, numbers, bigints, arrays, objects with toBytes(), and null/undefined (empty bytes).

Parameters

v

ToBytesInputTypes

Returns

Uint8Array

Throws

On invalid strings, negative bigints, or unsupported types