How to use the Buffer function from safe-buffer
Find comprehensive JavaScript safe-buffer.Buffer code examples handpicked from public code repositorys.
GitHub: browserify/randomfill
2 3 4 5 6 7 8 9 10 11
function oldBrowser () { throw new Error('secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11') } var safeBuffer = require('safe-buffer') var randombytes = require('randombytes') var Buffer = safeBuffer.Buffer var kBufferMaxLength = safeBuffer.kMaxLength var crypto = global.crypto || global.msCrypto var kMaxUint32 = Math.pow(2, 32) - 1 function assertOffset (offset, length) {
5
9
0
+ 3 other calls in file
106 107 108 109 110 111 112 113 114 115
if (opts.heartbeats) { // start ping/pong heartbeats heartbeats(socket) } // use the http basic auth as ID let rawID = _.has(headers, 'authorization') ? new Buffer( headers.authorization.replace('Basic ', ''), 'base64' ).toString() : UUID() let ID = makeSHA(rawID)
3
2
3
safe-buffer.from is the most popular function in safe-buffer (2601 examples)