var crypto = require('crypto'); var randomChars = crypto.randomBytes(50).toString('base64');That makes a synchronous call to randomBytes, so keep that in mind. If you want asynchronous then pass a second param to randomBytes:
var crypto = require('crypto'); crypto.randomBytes(70, function(err, buf){ console.log(buf.toString('base64')); });more info can be found here
No comments:
Post a Comment