# base64-uint8

> This package encodes and decodes `Uint8Array`s to and from strings.

Latest version **0.0.1** (published 2021-01-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install base64-uint8
pnpm add base64-uint8
yarn add base64-uint8
bun add base64-uint8
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2021-01-23 |
| First published | 2021-01-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 7.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Gorm Casper |
| Maintainers | casperin |
| Keywords | base64, encoder, decoder, uint8array |

## Links

- npm: https://www.npmjs.com/package/base64-uint8
- Repository: https://github.com/casperin/base64-uint8
- Homepage: https://github.com/casperin/base64-uint8#readme
- Issues: https://github.com/casperin/base64-uint8/issues
- npm.io page: https://npm.io/package/base64-uint8

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

- 0.0.1 (latest) — 2021-01-23

## README

# Base64 encoder

This package encodes and decodes `Uint8Array`s to and from strings.

There are no dependencies. It does not use `atob` or `buffer`. The input for
the encoding can be any old array of numbers between 0 and 255 if you like, but
the output of the decoding will be a `Uint8Array`.

[The code](./index.js) is written with lots of comments and follows an example
from Wikipedia to make it all easier to understand and learn from.

Simple code also usually means performant code, so I suspect this
implementation is quite performant as well.

I wrote it as a quick learning project for myself.


## Usage

```js
import fs from "fs";
import { encode, decode } from './index.js';

// Buffer with the content of this README.md
const readme_bytes = fs.readFileSync("./README.md");

// Base64 string
const readme_encoded = encode(readme_bytes);

// Uint8Array that equals readme_bytes (except buffer != Uint8Array)
const readme_decoded = decode(readme_encoded);
```

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