fc-base62
A javascript Base62 encode/decoder for node.js
Install
npm install base62
Usage
Default Character Set Example
Base62 = Base62 // 'g7'Base62 // 999
Custom Character Set Example
The default character set 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 setCharacterSet()
method on the Base62 object passing in the string "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
. Note that all characters must be unique.
Base62 = Base62;Base62 // 'G7'Base62 // 999