random-hex-string

1.0.0 • Public • Published

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)

/random-hex-string/

    Package Sidebar

    Install

    npm i random-hex-string

    Weekly Downloads

    5

    Version

    1.0.0

    License

    MIT

    Last publish

    Collaborators

    • rogerbf