Skip to main content
To write a ReadableStream to disk, create a Response from the stream and pass it to Bun.write().
const stream: ReadableStream = ...;
const path = "./file.txt";
const response = new Response(stream);

await Bun.write(path, response);

See Bun.write().