This commit is contained in:
Colin McDonnell
2023-07-26 14:59:39 -07:00
committed by GitHub
parent 6bfee02301
commit 4c89c60867
90 changed files with 2246 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
---
name: Convert a Blob to a ReadableStream
---
The [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) class provides a number of methods for consuming its contents in different formats, inluding `.stream()`. This returns `Promise<ReadableStream>`.
```ts
const blob = new Blob(["hello world"]);
const stream = await blob.stream();
```
---
See [Docs > API > Binary Data](/docs/api/binary-data#conversion) for complete documentation on manipulating binary data with Bun.