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

# 将 ArrayBuffer 转换为字符串

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

```ts theme={null}
const buf = new ArrayBuffer(64);
const decoder = new TextDecoder();
const str = decoder.decode(buf);
```

***

参见 [二进制数据](/runtime/binary-data#conversion)。
