Skip to content

Blobs.to

Transforms Ox-shaped Blobs.Blobs into the originating data.

Imports

Named
import { Blobs } from 'ox'

Examples

import { Blobs, Hex } from 'ox'
 
const blobs = Blobs.from('0xdeadbeef')
const data = Blobs.to(blobs)
'0xdeadbeef'

Configuring Return Type

It is possible to configure the return type with second argument.

import { Blobs } from 'ox'
 
const blobs = Blobs.from('0xdeadbeef')
const data = Blobs.to(blobs, 'Bytes')
Uint8Array [ 13, 174, 190, 239 ]

Definition

function to<blobs, to>(
  blobs: blobs | Blobs<Hex.Hex> | Blobs<Bytes.Bytes>,
  to?: to | 'Hex' | 'Bytes' | undefined,
): to.ReturnType<to>

Source: src/Blobs.ts

Parameters

blobs

  • Type: blobs | Blobs<Hex.Hex> | Blobs<Bytes.Bytes>

The Blobs.Blobs to transform.

to

  • Type: to | 'Hex' | 'Bytes' | undefined
  • Optional

The type to transform to.

Return Type

The originating data.

to.ReturnType<to>

Error Type

Blobs.to.ErrorType