# b62

> Encode and decode strings to base62

Latest version **0.0.2** (published 2015-05-27) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2015-05-27 |
| First published | 2015-05-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Dario Marcelino |
| Maintainers | dmarcelino |
| Keywords | base62, base 62, encode, decode, url-safe, base64 |

## Links

- npm: https://www.npmjs.com/package/b62
- Repository: https://github.com/dmarcelino/b62
- Homepage: https://github.com/dmarcelino/b62#readme
- Issues: https://github.com/dmarcelino/b62/issues
- npm.io page: https://npm.io/package/b62

## Dependencies (1)

- [bignum](https://npm.io/package/bignum.md) ^0.10.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

- 0.0.2 (latest) — 2015-05-27
- 0.0.1 — 2015-05-26

## README

[![npm version](https://badge.fury.io/js/b62.svg)](http://badge.fury.io/js/b62)
[![Build Status](https://travis-ci.org/dmarcelino/uuid-base62.svg?branch=master)](https://travis-ci.org/dmarcelino/uuid-base62)

# b62
Encode and decode strings to base62 (and others)

## Overview
The most popular [base62 encoder](https://www.npmjs.com/package/base62) and others only support converting a `number` to base62. This becomes a problem when trying to convert a big number with a precision higher than 52 bits like, for example, an UUID. Hence `b62`, which allows to convert strings (and not only) to base62.

> Meanwhile I've found [base-x](https://github.com/dcousens/base-x) which is much faster ([20x](https://gist.github.com/dmarcelino/879d4da2a0e0c32f7d74)) than b62! The only nuisance is that you need to supply a buffer. If performance is important to you, use base-x! In the future b62 may be changed to use base-x underneath.

## Instalation
```shell
npm i b62 -S
```

## Usage
```javascript
var b62 = require('b62');

var encoded = b62.encode("Hello World!");
// -> t8DGCJrgKz3AYSDn

var decoded = b62.decoded("t8DGCJrgKz3AYSDn");
// -> Hello World!
```

You can also use other bases, for example:
```javascript
var b64 = b62("-_0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");

var encoded = b64.encode("Hi this is b64 example");
// -> _6og_Oo4zN64zN646Qb0_zs43Hq4Lz

var decoded = b62.decoded("t8DGCJrgKz3AYSDn");
// -> Hi this is b64 example
```

## License
MIT

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