# Bun Write a ReadableStream to a file

> Write a ReadableStream to a file

- Skill: `jarle/bun-write-a-readablestream-to-a-file` (Agent Skill)
- Install (CLI): `npx skillmds@latest add jarle/bun-write-a-readablestream-to-a-file`
- Raw SKILL.md: https://api.skillmd.com/api/skills/jarle/bun-write-a-readablestream-to-a-file/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: jarle (https://skillmd.com/u/jarle)
- Updated: 2026-09-21
- Page: https://skillmd.com/skills/jarle/bun-write-a-readablestream-to-a-file

---


# Write a ReadableStream to a file

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()`](/runtime/file-io#writing-files-bun-write).

```ts  theme={"theme":{"light":"github-light","dark":"dracula"}}
const stream: ReadableStream = ...;
const path = "./file.txt";
const response = new Response(stream);

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

***

See [Docs > API > File I/O](/runtime/file-io#writing-files-bun-write) for complete documentation of `Bun.write()`.

