Closed AmitMY closed 9 months ago
P.S Gunzip support would not be hard to add. Here is an example:
const gunzip = zlib.createGunzip();
fs.createReadStream(this.path).pipe(gunzip);
return new Promise((resolve, reject) => {
const buffer = [];
gunzip
.on('data', (data) => buffer.push(data.toString()))
.on('end', () => resolve(buffer.join("")))
.on('error', (e) => reject(e));
})
yauzl is for zip files. You can test if a file is a zip file by opening it with yauzl and checking for an immediate error or not. How to handle non-zip files is beyond the scope of this library.
If I try to unzip a zip file it works, but a
gzip
file fails with:If I manually use winrar for example, the file is not corrupted and works correctly.