node package manager

shortlink

Simple generation, encoding and decoding short links library for Node.js.

node-shortlink Build Status

Simple generation, encoding and decoding short links library for Node.js.

What?

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.

Alphabet

base58: '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ'

Installation

npm install shortlink --save

Usage

var shortlink = require('shortlink');
 
shortlink.generate(8);         // Random string of 8 characters, e.g. 'PJWn4T42'   
shortlink.encode(8515010570);  // 'dYrDZ5' 
shortlink.decode('dYrDZ5');    // 8515010570 

Running Tests

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

Package manager page

NPM

Direct link to the package

License

Released under the MIT license. Copyright (c) 2013 Andrey Chizh.