randomr
v4.0.3 random hex password base64
randomr
Easily generate random strings of any length
Usage
Installation:
Use yarn
or npm
:
$ [sudo] npm install randomr --save
Sync API:
var randomr = require('randomr')
randomr(size, type)
defaults: 32
, "hex"
Size in bytes, type (optional): e.g. hex
or base64
randomr(8, 'hex') // => 'c7184ef1'
randomr(4096) // => '0wZTkZdVyenwd3uPq8mCidkSjxb0Qz0EtQUengt.....'
Async API:
Returns a Promise
with a single string result value.
var randomr = require('randomr/async')
randomr(8)
.then((result) => result) // => 'c7184ef1'
randomr(4096, 'base64')
.then((result) => result) // => '0wZTkZdVyenwd3uPq8mCidkSjxb0Qz0EtQUengt.....'