archiverjs / node-archiver

a streaming interface for archive generation
https://www.archiverjs.com
MIT License
2.82k stars 220 forks source link

Zlib level doesn't have any change on the size of the archive #595

Open rajashree23 opened 2 years ago

rajashree23 commented 2 years ago

Hello! I use node-archiver to create an archive. I tried using different levels in lib but the archive size is the same i.e no compression is happening, and the output size is the summation of original data.

The following is a small part of my code

const archiver = require('archiver');
await new Promise((resolve, reject) => {  
        //Creating archiver
        const archive = archiver("zip", {zlib: { level: 9}});
        archive.on('error', reject);

        uploadStream.on('close', resolve);
        uploadStream.on('end', resolve);
        uploadStream.on('error', reject);

        //connecting archive to uploadStream via pipe.
        archive.pipe(uploadStream);
        s3FileStreams.forEach(s3FileStream => {
            archive.append(s3FileStream.stream, {
                name: s3FileStream.fileName
            });
        });
        archive.finalize();
    }).catch(error => {
        logger.error(metadata, error.message);
    });

It happens that no matter the zlib level I choose, the archive has still the same size. I am using three files of 30, 60,100MB respectively and the output is 190MB.

I tried the following methods but the output is still the same

Can someone please help me out here as it is a very high priority task from my end?

leny commented 2 years ago

Hi, same issue here.

cor1 commented 2 years ago

same here