Skip to content
NewBun 1.4.5 is out. Release notes
AphrodyBun

Guides · Streams

Convert a Node.js Readable to a string

Read a Node.js Readable stream into a string by wrapping it in a Response and calling .text().

To convert a Node.js Readable stream to a string in Bun, create a Response with the stream as the body, then call response.text().

import { Readable } from "stream";
const stream = Readable.from([Buffer.from("Hello, world!")]);
const text = await new Response(stream).text();
console.log(text); // "Hello, world!"