ZJONSSON / node-unzipper

node.js cross-platform unzip using streams
Other
423 stars 113 forks source link

Attempt to decompress latest Maxmind GeoLite archive causes the error #279

Open gugu opened 1 year ago

gugu commented 1 year ago

The error is:

node:internal/process/promises:288
            triggerUncaughtException(err, true /* fromPromise */);
            ^

Error: unexpected end of file
    at Zlib.zlibOnError [as onerror] (node:zlib:189:17) {
  errno: -5,
  code: 'Z_BUF_ERROR'
}

standand zip tool handles this correctly:

kostenko@Ubuntu-2204-jammy-amd64-base ~/tmp> zip -T g.zip
test of g.zip OK

and

kostenko@Ubuntu-2204-jammy-amd64-base ~/tmp> unzip g.zip
Archive:  g.zip
replace GeoLite2-City-CSV_20230512/GeoLite2-City-Locations-de.csv? [y]es, [n]o, [A]ll, [N]one, [r]ename: A
  inflating: GeoLite2-City-CSV_20230512/GeoLite2-City-Locations-de.csv
  inflating: GeoLite2-City-CSV_20230512/LICENSE.txt
  inflating: GeoLite2-City-CSV_20230512/GeoLite2-City-Locations-en.csv
  inflating: GeoLite2-City-CSV_20230512/GeoLite2-City-Locations-pt-BR.csv
  inflating: GeoLite2-City-CSV_20230512/GeoLite2-City-Locations-zh-CN.csv
  inflating: GeoLite2-City-CSV_20230512/GeoLite2-City-Blocks-IPv6.csv
  inflating: GeoLite2-City-CSV_20230512/COPYRIGHT.txt
  inflating: GeoLite2-City-CSV_20230512/GeoLite2-City-Locations-es.csv
  inflating: GeoLite2-City-CSV_20230512/GeoLite2-City-Locations-ru.csv
  inflating: GeoLite2-City-CSV_20230512/GeoLite2-City-Locations-ja.csv
  inflating: GeoLite2-City-CSV_20230512/GeoLite2-City-Locations-fr.csv
  inflating: GeoLite2-City-CSV_20230512/GeoLite2-City-Blocks-IPv4.csv

I can send this file (50Mb) somewhere for investigation

ZJONSSON commented 3 weeks ago

You can send me the zip file via email (ziggy.jonsson.nyc@gmail) Also would be helpful to see the source code on how you are extracting, i.e. are you using the open methods or piping the entire zip file?