[Runtime
](../../../index.md)[Package Manager
](../../../pm/cli/install/index.md)[Bundler
](../../../bundler/index.md)[Test Runner
](../../../test/index.md)[Guides
](../../index.md)[Reference
](https://bun.com/reference)[Blog
](https://bun.com/blog)[Feedback
](../../../feedback/index.md)
To write a ReadableStream to disk, first create a Response instance from the stream. This Response can then be written to disk using Bun.write().
const stream: ReadableStream = ...;
const path = "./file.txt";
const response = new Response(stream);
await Bun.write(path, response);
See Docs > API > File I/O for complete documentation of Bun.write().
Was this page helpful?
[
Write a file incrementally
Previous
](../filesink/index.md)[
Write to stdout
Next
](../stdout/index.md)