Skip to content

Instantly share code, notes, and snippets.

@indexzero
Created May 20, 2011 06:26
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save indexzero/982447 to your computer and use it in GitHub Desktop.
Save indexzero/982447 to your computer and use it in GitHub Desktop.
A mock stream for node.js that is both Readable and Writeable.
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);
};
@reypatoy
Copy link

May I ask from this code if where that "helpers" object import from?
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment