public
Created — forked from indexzero/mockreadwritestream.js

A mock stream for node.js that is both Readable and Writeable.

  • Download Gist
mockreadwritestream.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
var events = require('events'),
util = require('util');
 
var MockReadWriteStream = helpers.MockReadWriteStream = function () {
//
// No need to do anything here, it's just a mock.
//
};
 
util.inherits(MockReadWriteStream, events.EventEmitter);
 
['resume', 'pause', 'setEncoding', 'flush'].forEach(function (method) {
MockReadWriteStream.prototype[method] = function () { /* Mock */ };
});
 
MockReadWriteStream.prototype.write = function (msg) {
this.emit('data', msg);
};

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.