1 | ;
|
2 | const stream_1 = require("stream");
|
3 | class CacheStream extends stream_1.Transform {
|
4 | constructor() {
|
5 | super();
|
6 | this._cache = [];
|
7 | }
|
8 | _transform(chunk, enc, callback) {
|
9 | const buf = chunk instanceof Buffer ? chunk : Buffer.from(chunk, enc);
|
10 | this._cache.push(buf);
|
11 | this.push(buf);
|
12 | callback();
|
13 | }
|
14 | getCache() {
|
15 | return Buffer.concat(this._cache);
|
16 | }
|
17 | }
|
18 | module.exports = CacheStream;
|
19 | //# sourceMappingURL=cache_stream.js.map |
\ | No newline at end of file |