UNPKG

ex-400-dev

Version:

EX-400 development library

15 lines (11 loc) 423 B
var stream = require("stream"); var Transport = module.exports = function Transport() { stream.Transform.call(this, {objectMode: true}); this._counter = 1; }; Transport.prototype = Object.create(stream.Transform.prototype, {constructor: {value: Transport}}); Transport.prototype._transform = function _transform(input, encoding, done) { this.emit("msg:"+(this._counter++), input); this.push(input); done(); };