Bytes.fromNumber
Encodes a number value into Bytes.Bytes
.
Imports
Named
import { Bytes } from 'ox'
Examples
import { Bytes } from 'ox'
const data = Bytes.fromNumber(420)
Uint8Array([1, 164])
import { Bytes } from 'ox'
const data = Bytes.fromNumber(420, { size: 4 })
Uint8Array([0, 0, 1, 164])
Definition
function fromNumber(
value: bigint | number,
options?: fromNumber.Options | undefined,
): Uint8Array
Source: src/core/Bytes.ts
Parameters
value
- Type:
bigint | number
Number value to encode.
options
- Type:
fromNumber.Options | undefined
- Optional
Encoding options.
Return Type
Encoded Bytes.Bytes
.
Uint8Array