Skip to content

Bytes.toString

Decodes a Bytes.Bytes into a string.

Imports

Named
import { Bytes } from 'ox'

Examples

import { Bytes } from 'ox'
 
const data = Bytes.toString(Bytes.from([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33]))
'Hello world'

Definition

function toString(
  bytes: Bytes,
  options?: toString.Options,
): string

Source: src/core/Bytes.ts

Parameters

bytes

  • Type: Bytes

The Bytes.Bytes to decode.

options

  • Type: toString.Options
  • Optional

Options.

options.size

  • Type: number
  • Optional

Size of the bytes.

Return Type

Decoded string.

string