# base32lib

> JavaScript Base32 encoding/decoding

Latest version **1.0.5** (published 2023-02-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install base32lib
pnpm add base32lib
yarn add base32lib
bun add base32lib
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.0.5 |
| Published | 2023-02-23 |
| First published | 2023-02-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.12.0 |
| Dependencies | 0 |
| Unpacked size | 15.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Michele Dandrea |
| Maintainers | mdandre |
| Keywords | base32, base32hex, crockford, z-32, rfc4648, geohash, encoding, decoding |

## Links

- npm: https://www.npmjs.com/package/base32lib
- Repository: https://github.com/elephantcastle/base32js
- Homepage: https://github.com/elephantcastle/base32js#readme
- Issues: https://github.com/elephantcastle/base32js/issues
- npm.io page: https://npm.io/package/base32lib

## Alternatives

- [flatbuffers](https://npm.io/package/flatbuffers.md) — 6.0M 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
- [datasets-fi-postalcodes](https://npm.io/package/datasets-fi-postalcodes.md) — 1.1K weekly downloads

## Recent versions

- 1.0.5 (latest) — 2023-02-23
- 1.0.4 — 2023-02-21
- 1.0.3 — 2023-02-20
- 1.0.2 — 2023-02-20
- 1.0.1 — 2023-02-19
- 1.0.0 — 2023-02-19

## README

# Base 32 encoding/decoding for JavaScript

![License](https://img.shields.io/github/license/elephantcastle/base32lib)
![npm version](https://img.shields.io/github/package-json/v/elephantcastle/base32lib)
<!-- ![Coverage](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/MishaKav/5e90d640f8c212ab7bbac38f72323f80/raw/jest-coverage-comment__main.json) -->

Base 32 is between hexadecimal notation and Base 64 encoding. It's intended to be a **human-friendly** -- you don't have to worry about punctuation, capitalization, or letters/numbers that are easy to confuse, making it easier to transmit in handwriting or over the phone.

Base 32 will work the same with upper- or lowercase, you can mistake a number for a similar-looking letter, and it will *still* decode to the same data.

## Getting started

In your shell, install with npm:

```sh
npm install base32lib
```

In your code:

```javascript
const base32lib = require('base32lib')

// encodings available: crockford, rfc4648, z-32, geohash, 32hex
// The default one is RFC4648
const encoded = base32lib.encode('some data to encode 123', 'rfc4648') //onxw2zjamrqxiyjaorxsazlomnxwizjagezdg===
const encoded2 = base32lib.encode('Some data to encOde 123') //onxw2zjamrqxiyjaorxsazlomnxwizjagezdg===
console.log(encoded === encoded2) // true
const decoded = base32lib.decode(encoded) // some data to encode 123
```

The main specifications of something called "Base 32" are present in this library: RFC4648, Crockford, z-32, geohash, 32hex - see [Wikipedia](http://en.wikipedia.org/wiki/Base_32) for some of them.

## Minispec

- When *decoding*, capital letters are converted to lowercase and the depending on the spec "ambiguous" letters mentioned might be converted to their numeric counterparts.
- Each character corresponds to 5 bits of input.
- Lexicographic order of strings is preserved through Base 32 encoding.

## Formalia

Under MIT License.

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