UNPKG

charlike

Version:

Small, fast, simple and streaming project scaffolder for myself, but not only. Supports hundreds of template engines through the @JSTransformers API or if you want custom `render` function passed through options

35 lines (26 loc) 539 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(_, _, cb) { setImmediate(cb); };