Blobs.from
Transforms arbitrary data to Blobs.Blobs.
Imports
Named
import { Blobs } from 'ox'Examples
import { Blobs } from 'ox'
const blobs = Blobs.from('0xdeadbeef')Creating Blobs from a String
An example of creating Blobs from a string using Hex.from:
import { Blobs, Hex } from 'ox'
const blobs = Blobs.from(Hex.fromString('Hello world!'))Configuring Return Type
It is possible to configure the return type for the Blobs with the as option.
import { Blobs } from 'ox'
const const blobs: readonly Uint8Array[]blobs = Blobs.from('0xdeadbeef', { as: 'Bytes' })
Definition
function from<data, as>(
data: data | Hex.Hex | Bytes.Bytes,
options?: from.Options<as>,
): from.ReturnType<as>Source: src/core/Blobs.ts
Parameters
data
- Type:
data | Hex.Hex | Bytes.Bytes
The data to convert to Blobs.Blobs.
options
- Type:
from.Options<as> - Optional
Options.
options.as
- Type:
"Bytes" | "Hex" | as - Optional
Return type.
Return Type
The Blobs.Blobs.
from.ReturnType<as>

