flat-generate

Generate machine unique ids and tokens.

npm install flat-generate
1 downloads in the last week
4 downloads in the last month

Description

Generate machine unique ids and tokens.

Installation

npm install flat-generate

Usage


var generate = require('flat-generate');

// Generate unique id, based on twitter snowflake pattern.
generate.id(function(error, id) {
  // ...
});

// Generates unique token.
generate.token(function(error, token) {
  // ...
});

// Machine hash, unique hash to identify machines, 
// used to generate unique ids.
var machineHash = generate.MACHINE_HASH;

// Token length, the length of tokens that are generated by 
// generate.token, is 8 by default.
var tokenLength = generate.TOKEN_LENGTH;
npm loves you