Subtheme of barrio
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

34 lines
550 B

var Writable = require('stream').Writable;
var inherits = require('util').inherits;
module.exports = resumer;
function resumer(stream) {
if (!stream.readable) {
return stream;
}
if (stream._read) {
stream.pipe(new Sink);
return stream;
}
if (typeof stream.resume === 'function') {
stream.resume();
return stream;
}
return stream;
}
function Sink() {
Writable.call(this, {
objectMode: true
});
}
inherits(Sink, Writable);
Sink.prototype._write = function(chunk, encoding, cb) {
setImmediate(cb);
};