forked from dachan/dach
1
0
Fork 0
dach/node_modules/random-bytes
leca 5a1e2a7730 implemented creation of boards, their listing, admin login and initialization of the database 2023-10-27 18:42:05 +03:00
..
HISTORY.md implemented creation of boards, their listing, admin login and initialization of the database 2023-10-27 18:42:05 +03:00
LICENSE implemented creation of boards, their listing, admin login and initialization of the database 2023-10-27 18:42:05 +03:00
README.md implemented creation of boards, their listing, admin login and initialization of the database 2023-10-27 18:42:05 +03:00
index.js implemented creation of boards, their listing, admin login and initialization of the database 2023-10-27 18:42:05 +03:00
package.json implemented creation of boards, their listing, admin login and initialization of the database 2023-10-27 18:42:05 +03:00

README.md

random-bytes

NPM Version NPM Downloads Node.js Version Build Status Test Coverage

Generate strong pseudo-random bytes.

This module is a simple wrapper around the Node.js core crypto.randomBytes API, with the following additions:

  • A Promise interface for environments with promises.
  • For Node.js versions that do not wait for the PRNG to be seeded, this module will wait a bit.

Installation

$ npm install random-bytes

API

var randomBytes = require('random-bytes')

randomBytes(size, callback)

Generates strong pseudo-random bytes. The size argument is a number indicating the number of bytes to generate.

randomBytes(12, function (error, bytes) {
  if (error) throw error
  // do something with the bytes
})

randomBytes(size)

Generates strong pseudo-random bytes and return a Promise. The size argument is a number indicating the number of bytes to generate.

Note: To use promises in Node.js prior to 0.12, promises must be "polyfilled" using global.Promise = require('bluebird').

randomBytes(18).then(function (string) {
  // do something with the string
})

randomBytes.sync(size)

A synchronous version of above.

var bytes = randomBytes.sync(18)

License

MIT