> ## 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.

# 将 ArrayBuffer 转换为字符串

Bun 实现了 Web 标准的 [`TextDecoder`](https://developer.mozilla.org/zh-CN/docs/Web/API/TextDecoder) 类，用于在二进制数据类型和字符串之间进行转换。

```ts theme={"theme":{"light":"github-light","dark":"dracula"}}
const buf = new ArrayBuffer(64);
const decoder = new TextDecoder();
const str = decoder.decode(buf);
```

***

完整的使用 Bun 操作二进制数据的文档请参见 [文档 > API > 二进制数据](/runtime/binary-data#conversion)。
