# Write a ReadableStream to a file (/docs/guides/write-file/stream)

<!-- agent-signals: reading_time_min: 1 · est_tokens: 91 · updated: 2026-07-28 -->
Related: [Append content to a file](/docs/guides/write-file/append.md), [Write a string to a file](/docs/guides/write-file/basic.md), [Write a Blob to a file](/docs/guides/write-file/blob.md), [Write a file to stdout](/docs/guides/write-file/cat.md), [Copy a file to another location](/docs/guides/write-file/file-cp.md), [Write a file incrementally](/docs/guides/write-file/filesink.md)

To write a `ReadableStream` to disk, create a `Response` from the stream and pass it to [`Bun.write()`](/runtime/file-io#writing-files-bun-write).

```ts
const stream: ReadableStream = ...;
const path = "./file.txt";
const response = new Response(stream);

await Bun.write(path, response);
```

***

See [`Bun.write()`](/runtime/file-io#writing-files-bun-write).
