In Bun, a Response accepts a Node.js Readable as its body.This works because Bun’s Response accepts any async iterable as its body, and Node.js streams are async iterables.
server.ts
import { Readable } from "stream";import { serve } from "bun";serve({ port: 3000, fetch(req) { return new Response(Readable.from(["Hello, ", "world!"]), { headers: { "Content-Type": "text/plain" }, }); },});