https://github.com/brianhung/uuid-base62
convert between uuid and base62 in the browser without Buffer or BigInt
https://github.com/brianhung/uuid-base62
base62 uuid
Last synced: 8 months ago
JSON representation
convert between uuid and base62 in the browser without Buffer or BigInt
- Host: GitHub
- URL: https://github.com/brianhung/uuid-base62
- Owner: BrianHung
- Created: 2020-07-20T10:41:42.000Z (almost 6 years ago)
- Default Branch: main
- Last Pushed: 2021-09-16T19:53:06.000Z (over 4 years ago)
- Last Synced: 2025-03-20T07:14:20.571Z (about 1 year ago)
- Topics: base62, uuid
- Language: TypeScript
- Homepage:
- Size: 11.7 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## uuid-base62
This is a library for converting between formatted uuid and its base62 representation, which is URL-safe.
In contrast to other libraries, we do not depend on `buffer` (which requires polyfill outside node.js) or
on `BigInt` (which is currently not supported by Safari). To extend the library past base62, define
the character set to a desired base N. Any base from 1 to N is then valid for `convertBase`.
### Usage
```bash
npm install --save @brianhung/uuid-base62
```
```js
import { v4 as uuidv4 } from "uuid";
import { uuidEncodeBase62, uuidDecodeBase62 } from "uuid-base62";
var uuid = uuidv4();
var base62 = uuidEncodeBase62(uuid);
console.log(uuid, uuidDecodeBase62(base62))
```