turn stream into buffer
@param {Object} stream
@param {Function} cb cb(err, buffer)
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);
    });
}