Files
bun.sh/docs/guides/streams/node-readable-to-blob.md
2024-04-18 22:46:43 -07:00

628 B

name
name
Convert a Node.js Readable to a Blob

To convert a Node.js Readable stream to a Blob in Bun, you can create a new Response object with the stream as the body, then use response.blob() to read the stream into a Blob.

import { Readable } from "stream";
const stream = Readable.from(["Hello, ", "world!"]);
const blob = await new Response(stream).blob();