17 lines
421 B
Plaintext
17 lines
421 B
Plaintext
---
|
|||
|
|
title: Convert a Blob to an ArrayBuffer
|
||
|
|
sidebarTitle: "Blob to ArrayBuffer"
|
||
|
|
mode: center
|
||
|
|
---
|
||
|
|
|
||
|
|
The [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) class provides several methods for consuming its contents in different formats, including `.arrayBuffer()`.
|
||
|
|
|
||
|
|
```ts
|
||
|
|
const blob = new Blob(["hello world"]);
|
||
|
|
const buf = await blob.arrayBuffer();
|
||
|
|
```
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
See [Binary Data](/runtime/binary-data#conversion).
|