1.0.0 • Published 7 years ago

random-hex-string v1.0.0

Weekly downloads
5
License
MIT
Repository
-
Last release
7 years ago

random-hex-string

Generate a random hex string synchronously or asynchronously with both callback and promise support. Uses crypto.randomBytes underneath.

usage

import randomHex from 'random-hex-string'

// synchronously
console.log(randomHex.sync(1))
// i.e. '67'

// asynchronously, callback
randomHex(2, (error, data) => {
  if (error) throw error
  console.log(data)
  // i.e. '231f'
})

// asynchronously, promise
randomHex(2)
.then(data)
.catch(error)