1 | "use strict";
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.default = void 0;
|
7 |
|
8 | var _stream = require("stream");
|
9 |
|
10 | function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 | class TapStream extends _stream.Transform {
|
17 | constructor(tap, options) {
|
18 | super({ ...options
|
19 | });
|
20 |
|
21 | _defineProperty(this, "_tap", void 0);
|
22 |
|
23 | this._tap = tap;
|
24 | }
|
25 |
|
26 | _transform(chunk, encoding, callback) {
|
27 | try {
|
28 | this._tap(Buffer.from(chunk));
|
29 |
|
30 | callback(null, chunk);
|
31 | } catch (err) {
|
32 | callback(err);
|
33 | }
|
34 | }
|
35 |
|
36 | }
|
37 |
|
38 | exports.default = TapStream; |
\ | No newline at end of file |