2.0.1 • Published 10 years ago
base64-mongo-id v2.0.1
Base64 Mongo Id
This library converts mongo ids into base64 strings. It has no dependencies and works in all browsers.
Methods
toBase64(mongoIdStr)- Input: A Mongo id or 24-character hex string
- Output: A 16-character base 64 string
toHex(shortedIdStr)- Input: A 16-character base 64 string
- Output: A 24-character hex string
Encoding System
The chosen base 64 encoding uses the following system. The characters were chosen to match common base 64 encoding schemes, but to be URL-safe.
0-A1-B2-C3-D4-E5-F6-G7-H8-I9-J10-K11-L12-M13-N14-O15-P16-Q17-R18-S19-T20-U21-V22-W23-X24-Y25-Z26-a27-b28-c29-d30-e31-f32-g33-h34-i35-j36-k37-l38-m39-n40-o41-p42-q43-r44-s45-t46-u47-v48-w49-x50-y51-z52-053-154-255-356-457-558-659-760-861-962-_63--