Skip to content

Bytes.padLeft

Pads a Bytes.Bytes value to the left with zero bytes until it reaches the given size (default: 32 bytes).

Imports

Named
import { Bytes } from 'ox'

Examples

import { Bytes } from 'ox'
 
Bytes.padLeft(Bytes.from([1]), 4)
Uint8Array([0, 0, 0, 1])

Definition

function padLeft(
  value: Bytes,
  size?: number | undefined,
): padLeft.ReturnType

Source: src/Bytes.ts

Parameters

value

  • Type: Bytes

Bytes.Bytes value to pad.

size

  • Type: number | undefined
  • Optional

Size to pad the Bytes.Bytes value to.

Return Type

Padded Bytes.Bytes value.

padLeft.ReturnType