# node-buffer-encoding

> A little wrapper around Node's Buffer that provides encoding/decoding for all supported encodings.

Latest version **1.0.3** (published 2025-01-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install node-buffer-encoding
pnpm add node-buffer-encoding
yarn add node-buffer-encoding
bun add node-buffer-encoding
```

## Health

**Score 40/100 (D)** — status: maintenance-mode.

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

Warnings: low downloads.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2025-01-15 |
| First published | 2022-04-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 3.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Maintainers | fabiospampinato |
| Keywords | node, buffer, encoding |

## Links

- npm: https://www.npmjs.com/package/node-buffer-encoding
- Repository: https://github.com/fabiospampinato/node-buffer-encoding
- Homepage: https://github.com/fabiospampinato/node-buffer-encoding#readme
- Issues: https://github.com/fabiospampinato/node-buffer-encoding/issues
- npm.io page: https://npm.io/package/node-buffer-encoding

## Alternatives

- [flatbuffers](https://npm.io/package/flatbuffers.md) — 6.0M weekly downloads
- [jwt-simple](https://npm.io/package/jwt-simple.md) — 259.5K weekly downloads
- [@exodus/patch-broken-hermes-typed-arrays](https://npm.io/package/@exodus/patch-broken-hermes-typed-arrays.md) — 28.5K weekly downloads
- [@native-to-anchor/buffer-layout](https://npm.io/package/@native-to-anchor/buffer-layout.md) — 12.2K weekly downloads
- [binary-parser-encoder](https://npm.io/package/binary-parser-encoder.md) — 5.3K weekly downloads

## Recent versions

- 1.0.3 (latest) — 2025-01-15
- 1.0.2 — 2024-04-04
- 1.0.1 — 2022-04-09
- 1.0.0 — 2022-04-09

## README

# Node Buffer Encoding

A little wrapper around Node's Buffer that provides encoding/decoding for all supported encodings.

If you have access to Node's Buffer you probably just want to use it directly instead. This module provides a unified API to some of my other modules, and allows me not to import "@types/node" everywhere.

## Install

```sh
npm install node-buffer-encoding
```

## Usage

```ts
import Encoding from 'node-buffer-encoding';

// Encode an Uint8Array with the given encoding

Encoding.encode ( new Uint8Array ([ 0, 255 ]), 'hex' ); // => '00ff'

// Encode a string with the given encoding

Encoding.encodeStr ( 'hello', 'base64' ); // => 'aGVsbG8='

// Decode a string with the given encoding to an Uint8Array

Encoding.decode ( '00ff', 'hex' ); // => Uint8Array(2) [ 0, 255 ]

// Decode a string with the given encoding to a string

Encoding.decodeStr ( 'aGVsbG8=', 'base64' ); // => 'hello'
```

## License

MIT © Fabio Spampinato

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