lib/buffer.js
function streamToBuffer(stream, cb){ // cb(err, buffer);
    var bufs = [];
    stream.on('data', function(d){
        bufs.push(d);
    })
    .on('end', function(){
        cb(null, Buffer.concat(bufs));
    })
    .on('error', function(err){
        cb(err);
    });
}
function streamToBuffer(stream, cb){ // cb(err, buffer);
    var bufs = [];
    stream.on('data', function(d){
        bufs.push(d);
    })
    .on('end', function(){
        cb(null, Buffer.concat(bufs));
    })
    .on('error', function(err){
        cb(err);
    });
}
function streamToBuffer ( stream , cb ) { // cb(err, buffer); var bufs = [ ] ; stream . on ( 'data' , function ( d ) { bufs . push ( d ) ; } ) . on ( 'end' , function ( ) { cb ( null , Buffer . concat ( bufs ) ) ; } ) . on ( 'error' , function ( err ) { cb ( err ) ; } ) ; }
turn stream into buffer
@param {Object} stream
@param {Function} cb cb(err, buffer)
turn stream into buffer