Skip to content

Bytes.toHex

Encodes a Bytes.Bytes value into a Hex.Hex value.

Imports

Named
import { Bytes } from 'ox'

Examples

import { Bytes } from 'ox'
 
Bytes.toHex(Bytes.from([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33]))
// '0x48656c6c6f20576f726c6421'

Definition

function toHex(
  value: Bytes,
  options?: toHex.Options,
): Hex.Hex

Source: src/core/Bytes.ts

Parameters

value

  • Type: Bytes

The Bytes.Bytes to decode.

options

  • Type: toHex.Options
  • Optional

Options.

options.size

  • Type: number
  • Optional

Size of the bytes.

Return Type

Decoded Hex.Hex value.

Hex.Hex