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

# 将 ReadableStream 转换为块数组

Bun 提供了多种便捷函数，可将 [`ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream) 的内容读取成不同格式。`Bun.readableStreamToArray` 函数会将 `ReadableStream` 的内容读取为一个块数组。

```ts theme={"theme":{"light":"github-light","dark":"dracula"}}
const stream = new ReadableStream();
const str = await Bun.readableStreamToArray(stream);
```

***

有关 Bun 其他 `ReadableStream` 转换函数的文档，请参见 [文档 > API > 工具](/runtime/utils#bun-readablestreamto)。
