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

# 将 DataView 转换为字符串

如果 [`DataView`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) 包含 ASCII 编码的文本，可以使用 [`TextDecoder`](https://developer.mozilla.org/en-US/docs/Web/API/TextDecoder) 类将其转换为字符串。

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

***

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