> ## 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 转换为字符串

Bun 实现了 Web 标准的 [`TextDecoder`](https://developer.mozilla.org/en-US/docs/Web/API/TextDecoder) 类，用于将像 `Uint8Array` 这样的二进制数据类型转换为字符串。

```ts theme={"theme":{"light":"github-light","dark":"dracula"}}
const arr = new Uint8Array([104, 101, 108, 108, 111]);
const decoder = new TextDecoder();
const str = decoder.decode(arr);
// => "hello"
```

***

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