mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
21 lines
385 B
TypeScript
21 lines
385 B
TypeScript
import randomBytes = require('random-bytes');
|
|
|
|
// Callback-based signature.
|
|
randomBytes(16, (err, buff) => {
|
|
if (err) {
|
|
console.error(err);
|
|
} else {
|
|
console.log(buff);
|
|
}
|
|
});
|
|
|
|
// Promise-based signature.
|
|
randomBytes(32)
|
|
.then((buff) => {
|
|
console.log(buff);
|
|
});
|
|
|
|
// Synchronous signature.
|
|
const buff = randomBytes.sync(64);
|
|
console.log(buff);
|