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

# 将 Uint8Array 转换为 DataView

[`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) 是一种 *类型化数组* 类，意味着它是查看底层 `ArrayBuffer` 中数据的一种机制。以下代码片段创建了一个 \[`DataView`] 实例，作用于与 `Uint8Array` 相同的数据范围。

```ts theme={"theme":{"light":"github-light","dark":"dracula"}}
const arr: Uint8Array = ...
const dv = new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
```

***

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