Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | 24x 24x 24x 24x 24x 19x 19x 19x 17x 19x 16x 16x 19x | var Promise = require('bluebird'); var Stream = require('stream'); var Buffer = require('./Buffer'); // Backwards compatibility for node versions < 8 Iif (!Stream.Writable || !Stream.Writable.prototype.destroy) Stream = require('readable-stream'); module.exports = function(entry) { return new Promise(function(resolve,reject) { var buffer = Buffer.from(''), bufferStream = Stream.Transform() .on('finish',function() { resolve(buffer); }) .on('error',reject); bufferStream._transform = function(d,e,cb) { buffer = Buffer.concat([buffer,d]); cb(); }; entry.on('error',reject) .pipe(bufferStream); }); }; |