Skip to content

toBlobs

Transforms arbitrary data into Viem-shaped blobs.

Import

import { toBlobs } from 'viem'

Usage

example.ts
import { toBlobs } from 'viem'
 
const blobs = toBlobs({ data: '0x...' })

Returns

Hex[] | ByteArray[]

Blobs from the input data.

Parameters

data

  • Type: Hex | ByteArray

Data to transform into blobs.

import { toBlobs } from 'viem'
 
const blobs = toBlobs({ 
  data: '0x...'
})

to

  • Type: "bytes" | "hex"

The output type.

import { toBlobs } from 'viem'
 
const blobs = toBlobs({ 
  data: '0x...',
  to: 'bytes'
})
 
const blobs: readonly Uint8Array[]
blobs