> ## Documentation Index
> Fetch the complete documentation index at: https://voltaire.tevm.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# Blob.toData

> Extract original data from blob (reads length prefix)

<Card title="Try it Live" icon="play" href="https://playground.tevm.sh?example=primitives/blob.ts">
  Run Blob examples in the interactive playground
</Card>

<Tabs />

## Encoding Format

Blobs created with `fromData()` use this format:

```
┌─────────────────┬──────────────┬─────────────┐
│  Length (8 B)   │  Data (N B)  │  Padding    │
├─────────────────┼──────────────┼─────────────┤
│ Little-endian   │ Original     │ Zero bytes  │
│ uint64          │ data         │             │
└─────────────────┴──────────────┴─────────────┘
  Bytes 0-7         Bytes 8-N      Bytes N+1-131071

Total: 131,072 bytes (Blob.SIZE)
```

### Example: Manual Decoding

```typescript theme={null}
import { Blob } from 'tevm';

const blob = Blob.fromData(new TextEncoder().encode("test"));

// Manual extraction (equivalent to toData())
const view = new DataView(blob.buffer, blob.byteOffset);
const length = Number(view.getBigUint64(0, true)); // Little-endian
const data = blob.slice(8, 8 + length);

console.log(length); // 4
console.log(new TextDecoder().decode(data)); // "test"
```

## See Also

* [fromData](./fromData) - Encode data into blob
* [from](./from) - Universal constructor
* [joinData](./joinData) - Join data from multiple blobs
