Skip to content

Hex.from

Instantiates a Hex.Hex value from a hex string or Bytes.Bytes value.

Imports

Named
import { Hex } from 'ox'

Examples

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

Definition

function from(
  value: Hex | Bytes.Bytes | readonly number[],
): Hex

Source: src/Hex.ts

Parameters

value

  • Type: Hex | Bytes.Bytes | readonly number[]

The Bytes.Bytes value to encode.

Return Type

The encoded Hex.Hex value.

Hex