uuid-base62
Base62 non-sequential url-friendly UUID generator (RFC4122)
Overview
uuid-base62 makes it easy to generate short base62 (or any other base) UUIDs. The unencoded UUIDs are generated by node-uuid which follows RFC4122. The encoded UUIDs are alphanumeric [0-9a-zA-Z] and always have a length of 22 chars.
Instalation
npm i uuid-base62 -S
Usage
var uuidBase62 = ; var uuid = uuidBase62;// -> 2qY9COoAhfMrsH7mCyh86T // if the original uuid is neededvar originalUuid = uuidBase62;// -> 9af099b2-6244-4fc1-b72b-1d69a24481b7 // if an uuid needs to be encodedvar encoded = uuidBase62;// -> 2fNwVYePN8WqqDFvVf7XMN
That's it. uuid-base62 also supports other bases, example for base64:
uuidBase62customBase = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_";var uuid = uuidBase62;// -> 31LoSI_BVeQpXtwu_-GEbL
For more examples check the tests.
License
MIT