Simple generation, encoding and decoding short links library for Node.js.
Short links makes it easier for users to recall and share the locations of important documents and web sites.
This library is used by default Base58 encoding and can represent numeric values with fewer characters and easy understandable view.
base58: '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ'
npm install shortlink --save
var shortlink = require('shortlink');
shortlink.generate(8); // Random string of 8 characters, e.g. 'PJWn4T42'
shortlink.encode(8515010570); // 'dYrDZ5'
shortlink.decode('dYrDZ5'); // 8515010570
To run the test suite first invoke the following command within the repo, installing the development dependencies:
npm install
then run the tests:
npm test
Direct link to the package
Released under the MIT license. Copyright (c) 2013 Andrey Chizh.