source: frontend/node_modules/axios/lib/helpers/ZlibHeaderTransformStream.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 13 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 688 bytes
RevLine 
[9af201e]1'use strict';
2
3import stream from 'stream';
4
5class ZlibHeaderTransformStream extends stream.Transform {
6 __transform(chunk, encoding, callback) {
7 this.push(chunk);
8 callback();
9 }
10
11 _transform(chunk, encoding, callback) {
12 if (chunk.length !== 0) {
13 this._transform = this.__transform;
14
15 // Add Default Compression headers if no zlib headers are present
16 if (chunk[0] !== 120) {
17 // Hex: 78
18 const header = Buffer.alloc(2);
19 header[0] = 120; // Hex: 78
20 header[1] = 156; // Hex: 9C
21 this.push(header, encoding);
22 }
23 }
24
25 this.__transform(chunk, encoding, callback);
26 }
27}
28
29export default ZlibHeaderTransformStream;
Note: See TracBrowser for help on using the repository browser.