> ## Documentation Index
> Fetch the complete documentation index at: https://bun.ll1025.cn/llms.txt
> Use this file to discover all available pages before exploring further.

# 将 ReadableStream 写入文件

要将 `ReadableStream` 写入磁盘，请从流创建一个 `Response`，然后将其传递给 [`Bun.write()`](/runtime/file-io#writing-files-bun-write)。

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

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

***

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