# Bun Convert a Buffer to a string

> Convert a Buffer to a string

- Skill: `jarle/bun-convert-a-buffer-to-a-string` (Agent Skill)
- Install (CLI): `npx skillmds@latest add jarle/bun-convert-a-buffer-to-a-string`
- Raw SKILL.md: https://api.skillmd.com/api/skills/jarle/bun-convert-a-buffer-to-a-string/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: jarle (https://skillmd.com/u/jarle)
- Updated: 2026-09-21
- Page: https://skillmd.com/skills/jarle/bun-convert-a-buffer-to-a-string

---


# Convert a Buffer to a string

The [`Buffer`](https://nodejs.org/api/buffer.html) class provides a built-in `.toString()` method that converts a `Buffer` to a string.

```ts  theme={"theme":{"light":"github-light","dark":"dracula"}}
const buf = Buffer.from("hello");
const str = buf.toString();
// => "hello"
```

***

You can optionally specify an encoding and byte range.

```ts  theme={"theme":{"light":"github-light","dark":"dracula"}}
const buf = Buffer.from("hello world!");
const str = buf.toString("utf8", 0, 5);
// => "hello"
```

***

See [Docs > API > Binary Data](/runtime/binary-data#conversion) for complete documentation on manipulating binary data with Bun.

