Skip to content

Hex.fromBytes

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

Imports

Named
import { Hex } from 'ox'

Examples

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

Definition

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

Source: src/Hex.ts

Parameters

value

  • Type: Bytes.Bytes

The Bytes.Bytes value to encode.

options

  • Type: fromBytes.Options
  • Optional

Options.

options.size

  • Type: number
  • Optional

The size (in bytes) of the output hex value.

Return Type

The encoded Hex.Hex value.

Hex