2

I'm getting Headers Error when downloading files bigger than 4GB, with or without the 'forceZip64' option. The zip is generated on the go when streaming each file content one by one.

How zip file is created

// create zip archive
const zip = Archiver.create('zip', {
    store: true
    // forceZip64: contentLength > 4 * 1024 * 1024 * 1024
});
// pipe zip to response
zip.pipe(response);

// iterate targets download
for (const files of file) {
   const stream = await this.downloadFile(file.source); // returns Readable
   zip.append(stream, { name: file.source.filename });

   // await to download files one by one.
   await new Promise((resolve, reject) => {
      // handle success
      stream.on('end', () => {
          resolve();
      });
      // handle error
      stream.on('error', (err) => {
          reject();
      });
   });
}

// finalize zip streaming
zip.finalize();

How zip file is unzipped

Using 7ZIP Ubuntu

  • For example when I download a file bigger than 4GB and then I try to uncompress it using 7zip I will get following output:
7-Zip (a) [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21
p7zip Version 16.02 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,64 bits,8 CPUs Intel(R) Core(TM) i7-7700T CPU @ 2.90GHz (906E9),ASM,AES-NI)

Scanning the drive for archives:
1 file, 15587398396 bytes (15 GiB)

Extracting archive: files.zip

ERRORS:
Headers Error

--
Path = files.zip
Type = zip
ERRORS:
Headers Error
Physical Size = 15587398396
64-bit = +

Using Unzip Mac Os & Ubuntu (UnZip 6.00 of 20 April 2009)

  • I will not get any error

Archive Utility Mac Os

  • "Unable to expand 'files.zip' into 'Downloads'."
  • "(Error 2 - No such file or directory)"

Results

Unzip program always work, 7ZIP complains about headers but finally it's unzipping well and Archive Utility (Mac Os default) cannot unzip the file.

In all cases the MD5 checksum matches the original one.

Does anyone faced this kind of problems with files bigger than 4GB (2^32B)?

All that I've done with zip's below 4GB are successfull and without any kind of errors or warnings.

Arnautg
  • 661
  • 6
  • 10

0 Answers0