# uuid-b32

> Convert uuid to and from base32 strings

Latest version **1.0.1** (published 2021-12-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install uuid-b32
pnpm add uuid-b32
yarn add uuid-b32
bun add uuid-b32
```

Provides the command `uuid-b32`.

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2021-12-15 |
| First published | 2021-12-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 9.1 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Martin Heidegger |
| Maintainers | leichtgewicht |
| Keywords | uuid, base-32, base32, short, id, friendly |

## Links

- npm: https://www.npmjs.com/package/uuid-b32
- Repository: https://github.com/martinheidegger/uuid-b32
- Homepage: https://github.com/martinheidegger/uuid-b32#readme
- Issues: https://github.com/martinheidegger/uuid-b32/issues
- npm.io page: https://npm.io/package/uuid-b32

## Dependencies (3)

- [uuid](https://npm.io/package/uuid.md) ^8.3.2
- [base32-decode](https://npm.io/package/base32-decode.md) ^1.0.0
- [base32-encode](https://npm.io/package/base32-encode.md) ^1.2.0

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2021-12-15
- 1.0.0 — 2021-12-15

## README

# Convert uuid to and from base32

UUID's for legacy reasons are usually encoded as hex strings like: `5b9e4740-5d4c-11ec-a260-8f8d5ea1937c`.
This encoding is quite long and not very human friendly. Using this util you can convert them using
`base32` encoding, which looks like this `BEF4EG2X9G8YS8K0HY6NX8CKFG`.

## JavaScript API

```javascript
const { encode, decode } = require('uuid-b32')

// create a base32 encoded uuidv4
const uuidCrockfordEncoded = encode()
const uuidRFC4648Encoded = encode(null, 'RFC4648')

// convert back to uuid
const uuid =
    decode(uuidCrockfordEncoded) ||
    decode(uuidRFC4648Encoded, 'RFC4648')

// convert exisiting uuid to base32
encode(uuid)
```

## Command Line Usage

You can also use it simply as a command line tool: `npx uuid-b32`

```
Generate or convert a uuid to/from base32 encoding

Usage: uuid-b32 (--uuid [uuid]) (--variant [variant]) (--b32 [uuid]) (--uuid-v1) (--uuid-v4)

    --variant ....... use base32 variant, supported variants: RFC3548, RFC4648, RFC4648-HEX, Crockford (default)
    --uuid .......... convert input uuid instead of generating new one
    --b32 ........... convert input base32 encoded uuid to uuid
    --uuid-v1 ....... when creating a new uuid, use uuid-v1 variant
    --uuid-v4 ....... when creating a new uuid, use uuid-v4 variant (default)
    -v, --version ... print the version
    -h, --help ...... print this help

Create a base32 uuid:

uuid-b32

Input using stdin is supported

echo <uuid> | uuid-b32 --uuid
echo <b32>  | uuid-b32 --b32
```

# License

[MIT](./LICENSE)

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