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

# 将 Buffer 转换为 Uint8Array

Node.js 的 [`Buffer`](https://nodejs.org/api/buffer.html) 类是 [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) 的扩展，因此不需要转换。`Uint8Array` 上的所有属性和方法都可用于 `Buffer`。

```ts theme={"theme":{"light":"github-light","dark":"dracula"}}
const buf = Buffer.alloc(64);
buf instanceof Uint8Array; // => true
```

***

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