0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/lib/_stream_passthrough.js

23 lines
526 B
JavaScript
Raw Normal View History

2012-10-03 00:44:50 +02: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 00:44:50 +02:00
module.exports = PassThrough;
const Transform = require('_stream_transform');
const util = require('util');
2012-10-03 00:44:50 +02:00
util.inherits(PassThrough, Transform);
function PassThrough(options) {
if (!(this instanceof PassThrough))
return new PassThrough(options);
2012-10-03 00:44:50 +02:00
Transform.call(this, options);
}
PassThrough.prototype._transform = function(chunk, encoding, cb) {
cb(null, chunk);
2012-10-03 00:44:50 +02:00
};