UNPKG

fut

Version:
23 lines (18 loc) 665 B
// 'use strict' // const Promise = require('bluebird') // const crypto = Promise.promisifyAll(require('crypto')) // const co = require('co') // const randomHex = co.wrap(function * (length) { // const randomStr = (yield crypto.randomBytesAsync(48)).toString('hex').substring(0, length) // return randomStr // }) // co(function * () { // let random = yield randomHex(5) // console.log(random) // }).catch((e) => console.error(e.stack)) // // require('crypto').randomBytes(48, function(err, buffer) { // // var token = buffer.toString('hex'); // // var token2 = buffer.toString('hex'); // // console.log(token) // // console.log(token2) // // });