# uint8-encoding

> Uint8 encoding, a simple way to convert strings to Uint8Arrays and vice versa.

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

## Install

```sh
npm install uint8-encoding
pnpm add uint8-encoding
yarn add uint8-encoding
bun add uint8-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 | 2.0.1 |
| Published | 2025-01-15 |
| First published | 2021-08-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 2.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Maintainers | fabiospampinato |
| Keywords | uint8, uint8array, arraybuffer, encoding |

## Links

- npm: https://www.npmjs.com/package/uint8-encoding
- Repository: https://github.com/fabiospampinato/uint8-encoding
- Homepage: https://github.com/fabiospampinato/uint8-encoding#readme
- Issues: https://github.com/fabiospampinato/uint8-encoding/issues
- npm.io page: https://npm.io/package/uint8-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

- 2.0.1 (latest) — 2025-01-15
- 2.0.0 — 2022-04-05
- 1.0.0 — 2021-08-14

## README

# Uint8 Encoding

Uint8 encoding, a simple way to convert strings to Uint8Arrays and vice versa.

It's just a simple wrapper around TextEncoder and TextDecoder, but it provides a cleaner API and it handles nuances like the BOM character for you.

## Install

```sh
npm install uint8-encoding
```

## Usage

```ts
import U8 from 'uint8-encoding';

// Encoding

const raw = 'Hello 😃';
const encoded = U8.encode ( raw );
console.log ( encoded ); // => Uint8Array(10) [72, 101, 108, 108, 111,  32, 240, 159, 152, 131]

// Decoding

const decoded = U8.decode ( encoded );
console.log ( decoded ); // => 'Hello 😃'
```

## License

MIT © Fabio Spampinato

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