Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Per file compression options in ZIP don't work as described #15

Closed
anongit opened this issue Dec 8, 2020 · 2 comments
Closed

Per file compression options in ZIP don't work as described #15

anongit opened this issue Dec 8, 2020 · 2 comments

Comments

@anongit
Copy link

anongit commented Dec 8, 2020

In the demo:

    // With fflate, we can choose which files we want to compress
    zipObj[file.name] = [buf, {
      level: ALREADY_COMPRESSED.indexOf(ext) == -1 ? 6 : 0
    }];

Changing 6 to 1 or to any other number except 0 doesn't affect the execution time or file size.
You have to change it here:

 if (!--left) {
      fflate.zip(zipObj, {
        // If you want to control options for every file, you can do so here
        // They are merged with the per-file options (if they exist)
        // mem: 9
        level: 1
      }, function(err, out) {

I see in the code, that you do merge them like it says in the comment, but in the following line instead of using the merged result you pass the default options:

} else term.push(deflate(file, opts as AsyncZipOptions, cbl));

@101arrowz
Copy link
Owner

Thanks for the bug report! That's quite a silly mistake, I'll fix that right now.

@101arrowz
Copy link
Owner

101arrowz commented Dec 8, 2020

@anongit Check v0.4.1 on NPM and the updated browser demo, the issue should be resolved. Thanks for taking the time to diagnose the issue as well, I appreciate it a lot!

101arrowz added a commit that referenced this issue Jan 14, 2021
101arrowz added a commit that referenced this issue Jan 14, 2021
101arrowz added a commit that referenced this issue Jan 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants