# Blobs.from

Transforms arbitrary data to [`Blobs.Blobs`](/api/Blobs/types#blobs).

## Imports

:::code-group
```ts [Named]
import { Blobs } from 'ox'
```

```ts [Entrypoint]
import * as Blobs from 'ox/Blobs'
```
:::

## Examples

```ts twoslash
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`](/api/Hex/from):

```ts twoslash
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.

```ts twoslash
import { Blobs } from 'ox'

const blobs = Blobs.from('0xdeadbeef', { as: 'Bytes' })
//    ^?
```

## Definition

```ts
function from<data, as>(
  data: data | Hex.Hex | Bytes.Bytes,
  options?: from.Options<as>,
): from.ReturnType<as>
```

**Source:** [src/core/Blobs.ts](https://github.com/wevm/ox/blob/main/src/core/Blobs.ts#L755)

## Parameters

### data

* **Type:** `data | Hex.Hex | Bytes.Bytes`

The data to convert to [`Blobs.Blobs`](/api/Blobs/types#blobs).

### options

* **Type:** `from.Options<as>`
* **Optional**

Options.

#### options.as

* **Type:** `"Bytes" | "Hex" | as`
* **Optional**

Return type.

## Return Type

The [`Blobs.Blobs`](/api/Blobs/types#blobs).

`from.ReturnType<as>`
