Bytes.from
Instantiates a Bytes.Bytes
value from a Uint8Array
, a hex string, or an array of unsigned 8-bit integers.
Imports
Named
import { Bytes } from 'ox'
Examples
import { Bytes } from 'ox'
const data = Bytes.from([255, 124, 5, 4])
Uint8Array([255, 124, 5, 4]) const data = Bytes.from('0xdeadbeef')
Uint8Array([222, 173, 190, 239])
Definition
function from(
value: Hex.Hex | Bytes | readonly number[],
): Bytes
Source: src/Bytes.ts
Parameters
value
- Type:
Hex.Hex | Bytes | readonly number[]
Value to convert.
Return Type
A Bytes.Bytes
instance.
Bytes
Error Type
Bytes.from.ErrorType