Skip to content

zlib.createGunzip "unknown compression method" #5852

Description

@dpicky

Since upgrading to 5.9.0 getting lots of "unknown compression method" errors when trying to uncompress files (using zlib.createGunzip) that work in previous versions of Node include 5.8

  • Version: v5.9.0
  • Platform: Both OSX and Linux (CentOS)
  • Subsystem: zlib

Activity

  1. added
    zlibIssues and PRs related to the zlib module and its compression dependencies.
    on Mar 22, 2016
  2. jasnell commented on Mar 22, 2016

    @jasnell
    Member

    @evanlucas @thealphanerd ... possible zlib regression in v5.9? Could #5120 be to blame?

    @dpicky ... can you provide an example test case that demonstrates the problem reliably?

  3. Trott commented on Mar 22, 2016

    @Trott
    Member

    @dpicky ... can you provide an example test case that demonstrates the problem reliably?

    More details would be useful. Straightforward use case does not have this problem as far as I can tell:

    $ cat test.js
    'use strict';
    var zlib = require('zlib');
    
    zlib.gzip('hello', function(err, data) {
      if (err) { 
        return console.log('err', err);
      }
      var unzip = zlib.createGunzip();
      unzip.write(data);
      unzip.on('data', function (data) {
        console.log(data.toString());
      });
    });
    $ node -v
    v5.9.0
    $ uname -a
    Darwin LIB-0S8DV17-LT 13.4.0 Darwin Kernel Version 13.4.0: Wed Mar 18 16:20:14 PDT 2015; root:xnu-2422.115.14~1/RELEASE_X86_64 x86_64
    $ node test.js
    hello
    $
    
  4. Fishrock123 commented on Mar 23, 2016

    @Fishrock123
    Contributor

    @dpicky Could you give us some more info on what sort of files these are?

  5. floatdrop commented on Mar 23, 2016

    @floatdrop
    Contributor

    @Fishrock123 I have same issue on 5.9.0, but not on 5.8.0. Seems like to reproduce you need quite big file (I get error on about 150Mb point of gzipped file). File was created through standard gzip util without any additional parameters.

  6. addaleax commented on Mar 23, 2016

    @addaleax
    Member

    Just checked, this definitely was introduced in f380db2.

  7. addaleax commented on Mar 23, 2016

    @addaleax
    Member

    I can reproduce this by passing the gcc-5.3.0 tarball to createUnzip():

    const fs = require('fs');
    const zlib = require('zlib');
    
    let l = 0;
    
    fs.createReadStream('gcc-5.3.0.tar.gz')
      .pipe(zlib.createGunzip())
      .on('data', d => l += d.length);
    
    process.on('exit', () => console.log(l));

    results in

    598310912
    events.js:155
          throw er; // Unhandled 'error' event
          ^
    
    Error: unknown compression method
        at Zlib._handle.onerror (zlib.js:363:17)
    
  8. bnoordhuis commented on Mar 23, 2016

    @bnoordhuis
    Member
  9. addaleax commented on Mar 23, 2016

    @addaleax
    Member

    I think I got this, PR incoming. 😄

  10. 1 remaining item

  11. added a commit that references this issue on Apr 7, 2016
  12. thomasmodeneis commented on Dec 22, 2016

    @thomasmodeneis

    Hi,
    I just ran into this thing, is there any specific version where this is fixed ?

    events.js:154
          throw er; // Unhandled 'error' event
          ^
    
    Error: unknown compression method
        at Zlib._handle.onerror (zlib.js:363:17)
    
    $ node --version
    v5.9.1 
    

    Cheers.

  13. Trott commented on Dec 22, 2016

    @Trott
    Member

    @thomasmodeneis Fixed in 6.0.0 and above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    zlibIssues and PRs related to the zlib module and its compression dependencies.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions