| ; | |
| 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; | |
| // Add Default Compression headers if no zlib headers are present | |
| if (chunk[0] !== 120) { | |
| // Hex: 78 | |
| const header = Buffer.alloc(2); | |
| header[0] = 120; // Hex: 78 | |
| header[1] = 156; // Hex: 9C | |
| this.push(header, encoding); | |
| } | |
| } | |
| this.__transform(chunk, encoding, callback); | |
| } | |
| } | |
| export default ZlibHeaderTransformStream; | |
Xet Storage Details
- Size:
- 688 Bytes
- Xet hash:
- ac00a29dae868077daa0156fd9a4123b1ccf86ef94c09a8ec4333f39b4b42d27
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.