UNPKG

node-busmq

Version:

A high performance, highly-available and scalable, message bus and queueing system for node.js backed by Redis

23 lines (20 loc) 549 B
var crypto = window.crypto || window.msCrypto; module.exports = { randomBytes: function(size) { size = size * 2; var array = new Uint8Array(size); crypto.getRandomValues(array); array.toString = function(enc) { if (enc === 'hex') { var result = []; for (var i = 0; i < array.length; i++) { result.push(array[i].toString(16)); } return result.join('').substr(0, size); } else { return array.toString(enc); } }; return array; } };