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

# 将 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={null}
const dv: DataView = ...;
const decoder = new TextDecoder();
const str = decoder.decode(dv);
```

***

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