# @isaacs/buffer-to-string

> A better Buffer.toString()

Latest version **1.0.1** (published 2025-11-02) · BlueOak-1.0.0 license · 0 weekly downloads

## Install

```sh
npm install @isaacs/buffer-to-string
pnpm add @isaacs/buffer-to-string
yarn add @isaacs/buffer-to-string
bun add @isaacs/buffer-to-string
```

## Health

**Score 50/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2025-11-02 |
| First published | 2025-11-02 |
| Weekly downloads | 0 |
| License | BlueOak-1.0.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=18 |
| Dependencies | 0 |
| Unpacked size | 7.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Maintainers | isaacs |

## Links

- npm: https://www.npmjs.com/package/@isaacs/buffer-to-string
- Repository: https://github.com/tapjs/buffer-to-string
- Homepage: https://github.com/tapjs/buffer-to-string#readme
- Issues: https://github.com/tapjs/buffer-to-string/issues
- npm.io page: https://npm.io/package/@isaacs/buffer-to-string

## Recent versions

- 1.0.1 (latest) — 2025-11-02
- 1.0.0 — 2025-11-02

## README

# buffer-to-string

> A better Buffer.toString()

Displays buffer content in hex. Characters are grouped into
two-character bytes, with a customizable line wrap width.

## Install

```
$ npm install --save @isaacs/buffer-to-string
```

## Usage

```js
const bufferToString = require('buffer-to-string')

bufferToString(new Buffer([0, 1, 2, 3, 4, 5, 6]), 3)
/*
00 01 02
03 04 05
06
 */
```

## API

### bufferToString(buffer, [width])

#### input

Type: `Buffer`

The Buffer to stringify.

#### width

Type: `number`  
Default: `20`

The maximum width before wrapping a newline. It is measured in
bytes displayed. The maximum character width can be determined by
computing `(3 * width) - 1`.

---
_Source: https://npm.io/package/@isaacs/buffer-to-string · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
