Base62
Install
npm install base-62
How to use
base62 = base62 // 'jU'base62 // 1234
Custom Character Set Example
The default base 62 alphabet is 0-9a-zA-Z
. This can be updated to a custom character set. Naturally, it must be 62 characters long.
Instead of the character set 0-9a-zA-Z
you want to use 0-9A-Za-z
, call the setAlphabet()
method on the Base62 object passing in the string "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
. Note that all characters must be unique.
base62 = base62base62 // 'Ju'base62 // 1234
License
MIT. Copyright (c) Nicolas Lecoy.