# base32-encode

> Base32 encoder with support for multiple variants.

Latest version **2.0.0** (published 2021-07-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install base32-encode
pnpm add base32-encode
yarn add base32-encode
bun add base32-encode
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2021-07-24 |
| First published | 2016-08-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Node | ^12.20.0 \|\| ^14.13.1 \|\| >=16.0.0 |
| Dependencies | 1 |
| Unpacked size | 9.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 24 |
| Maintainers | linusu |
| Keywords | base32 encode, base32 encoder, base32, base32hex, crockford, encoder, rfc3548, rfc4648 |

## Links

- npm: https://www.npmjs.com/package/base32-encode
- Repository: https://github.com/LinusU/base32-encode
- Homepage: https://github.com/LinusU/base32-encode#readme
- Issues: https://github.com/LinusU/base32-encode/issues
- npm.io page: https://npm.io/package/base32-encode

## Dependencies (1)

- [to-data-view](https://npm.io/package/to-data-view.md) ^2.0.0

## 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.0 (latest) — 2021-07-24
- 1.2.0 — 2021-03-30
- 1.1.1 — 2019-02-26
- 1.1.0 — 2018-06-25
- 1.0.0 — 2017-12-14
- 0.1.1 — 2017-12-14
- 0.1.0 — 2016-08-21

## README

# Base32 Encode

Base32 encoder with support for multiple variants.

## Installation

```sh
npm install --save base32-encode
```

## Usage

```js
import base32Encode from 'base32-encode'
const data = new Uint8Array([0x74, 0x65, 0x73, 0x74])

console.log(base32Encode(data, 'Crockford'))
//=> EHJQ6X0

console.log(base32Encode(data, 'RFC4648'))
//=> ORSXG5A=

console.log(base32Encode(data, 'RFC4648', { padding: false }))
//=> ORSXG5A

console.log(base32Encode(data, 'RFC4648-HEX'))
//=> EHIN6T0=
```

## API

### `base32Encode(data, variant[, options])`

- `data` (`ArrayBuffer | Int8Array | Uint8Array | Uint8ClampedArray`, required)
- `variant` (`'RFC3548' | 'RFC4648' | 'RFC4648-HEX' | 'Crockford'`, required)
- `options` (`object`, optional)
  - `padding` (`boolean`, optional) - If set, forcefully enable or disable padding. The default behavior is to follow the default of the selected variant.
- returns `string`

Encode the data in `data` into a Base32 encoded string.

#### Variants

- `'RFC3548'` - Alias for `'RFC4648'`
- `'RFC4648'` - [Base32 from RFC4648](https://tools.ietf.org/html/rfc4648)
- `'RFC4648-HEX'` - [base32hex from RFC4648](https://tools.ietf.org/html/rfc4648)
- `'Crockford'` - [Crockford's Base32](http://www.crockford.com/wrmg/base32.html)

## See also

- [base32-decode](https://github.com/LinusU/base32-decode) - Base32 decoder

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