Tumortisch-Dist/resources/app/node_modules/wreck/lib/tap.js

29 lines
429 B
JavaScript
Raw Permalink Normal View History

2021-06-15 16:00:08 +02:00
'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);
}
};