random-bytes

WebJar for random-bytes

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

random-bytes
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

random-bytes
WebJar for random-bytes
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/crypto-utils/random-bytes

Download random-bytes

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/random-bytes/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>random-bytes</artifactId>
    <version>1.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/random-bytes/
implementation 'org.webjars.npm:random-bytes:1.0.0'
// https://jarcasting.com/artifacts/org.webjars.npm/random-bytes/
implementation ("org.webjars.npm:random-bytes:1.0.0")
'org.webjars.npm:random-bytes:jar:1.0.0'
<dependency org="org.webjars.npm" name="random-bytes" rev="1.0.0">
  <artifact name="random-bytes" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='random-bytes', version='1.0.0')
)
libraryDependencies += "org.webjars.npm" % "random-bytes" % "1.0.0"
[org.webjars.npm/random-bytes "1.0.0"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

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

This is a Node.js module available through the npm registry. Installation is done using the npm install command:

$ 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

org.webjars.npm

Versions

Version
1.0.0