_stream_passthrough.js 604 B

1234567891011121314151617181920212223242526
  1. // a passthrough stream.
  2. // basically just the most minimal sort of Transform stream.
  3. // Every written chunk gets output as-is.
  4. 'use strict';
  5. module.exports = PassThrough;
  6. var Transform = require('./_stream_transform');
  7. /*<replacement>*/
  8. var util = require('core-util-is');
  9. util.inherits = require('inherits');
  10. /*</replacement>*/
  11. util.inherits(PassThrough, Transform);
  12. function PassThrough(options) {
  13. if (!(this instanceof PassThrough)) return new PassThrough(options);
  14. Transform.call(this, options);
  15. }
  16. PassThrough.prototype._transform = function (chunk, encoding, cb) {
  17. cb(null, chunk);
  18. };