12345678910111213141516171819202122232425262728 |
- "use strict";
- import stream from "stream";
- class ZlibHeaderTransformStream extends stream.Transform {
- __transform(chunk, encoding, callback) {
- this.push(chunk);
- callback();
- }
- _transform(chunk, encoding, callback) {
- if (chunk.length !== 0) {
- this._transform = this.__transform;
-
- if (chunk[0] !== 120) {
- const header = Buffer.alloc(2);
- header[0] = 120;
- header[1] = 156;
- this.push(header, encoding);
- }
- }
- this.__transform(chunk, encoding, callback);
- }
- }
- export default ZlibHeaderTransformStream;
|