Tumortisch-Dist/resources/app/node_modules/wreck/lib/tap.js
2021-06-15 16:00:08 +02:00

29 lines
429 B
JavaScript

'use strict';
const Stream = require('stream');
const Payload = require('./payload');
const internals = {};
module.exports = internals.Tap = class extends Stream.Transform {
constructor() {
super();
this.buffers = [];
}
_transform(chunk, encoding, next) {
this.buffers.push(chunk);
next(null, chunk);
}
collect() {
return new Payload(this.buffers);
}
};