node/lib/_stream_passthrough.js

23 lines
522 B
JavaScript
Raw Normal View History

2012-10-03 06:44:50 +08:00
// a passthrough stream.
// basically just the most minimal sort of Transform stream.
// Every written chunk gets output as-is.
'use strict';
2012-10-03 06:44:50 +08:00
module.exports = PassThrough;
var Transform = require('_stream_transform');
var util = require('util');
util.inherits(PassThrough, Transform);
function PassThrough(options) {
if (!(this instanceof PassThrough))
return new PassThrough(options);
2012-10-03 06:44:50 +08:00
Transform.call(this, options);
}
PassThrough.prototype._transform = function(chunk, encoding, cb) {
cb(null, chunk);
2012-10-03 06:44:50 +08:00
};