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

# 将 Uint8Array 转换为字符串

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

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

***

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