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

there is difference between pako and 7zip #41

Closed
qlqllu opened this issue Oct 30, 2014 · 2 comments
Closed

there is difference between pako and 7zip #41

qlqllu opened this issue Oct 30, 2014 · 2 comments

Comments

@qlqllu
Copy link

qlqllu commented Oct 30, 2014

I have an UT to compare the zip content. The animated.zip is generated by 7zip.

"jszip": "2.4.0",
"pako": "0.2.5",

The result is different:

"PK\u0003\u0004\n\u0000\u0000\u0000\b\u0000\u0000\u00001E??\u0000A§\f\u0000\u0000O\u000f\u0000\u0000\f\u0000\u0000\u0000animated
"PK\u0003\u0004\n\u0000\u0000\u0000\b\u0000\u0000\u0000yC??\u0000A-\f\u0000\u0000O\u000f\u0000\u0000\f\u0000\u0000\u0000animated

This is the code:

var jsZIP = require('jszip');
var pako = require("pako");

jsZIP.compressions.DEFLATE.compress = function (input) {
  return pako.deflateRaw(input);
};

describe('Animated GIF compression', function() {
  it('Compression animated.gif', function() {
    var zip = new jsZIP();
    var fileContent = fs.readFileSync(
      path.join(__dirname, 'animated.gif'), {
        encoding: 'base64'
      }
    );
    zip.file('animated.gif', fileContent, {
      base64: true,
      date: new Date("Sep 17, 2014")
    });
    var data = zip.generate({
      type: 'nodebuffer',
      compression: 'DEFLATE'
    });
    var zipContent = fs.readFileSync(
      path.join(__dirname, 'animated.zip')
    );
    assert.strictEqual(data.toString('binary'), zipContent.toString('binary'));
  });
});
@puzrin
Copy link
Member

puzrin commented Oct 30, 2014

Deflate algorythm has multiple setting to tune output (compression level, for example). This library is zlib port, and guaranty the same output for the same options. I don't understand, why do you ask about 7zip here - it's not related, and i don't know it's settings.

@puzrin
Copy link
Member

puzrin commented Nov 15, 2014

Closed - not related to this project.

@puzrin puzrin closed this as completed Nov 15, 2014
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