-
-
Save murindwaz/b12a471c6ab0608d5e5db1c46b34caa6 to your computer and use it in GitHub Desktop.
A mock stream for node.js that is both Readable and Writeable.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment