You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Zip class streams, zip and zipSync functions do not correctly support saving a .zip file with more than 65,535 file entries.
How to reproduce
node:
import*asfflatefrom'fflate';constentries=Array.from({length: 70_000},(_,i)=>[`${i}`,fflate.strToU8(`Content ${i}`)]);{constzipped=fflate.zipSync(Object.fromEntries(entries));constfiles=Object.entries(fflate.unzipSync(zipped));console.log(`in zip created by zipSync function: ${files.length} files found`);}{fflate.zip(Object.fromEntries(entries),(err,zipped)=>{if(err)throwerr;constfiles=Object.entries(fflate.unzipSync(zipped));console.log(`in zip created by zip async function: ${files.length} files found`);});}{constchunks=[];constzip=newfflate.Zip((err,chunk,final)=>{if(err)throwerr;chunks.push(chunk);if(final){constzipped=Buffer.concat(chunks);constfiles=Object.entries(fflate.unzipSync(zipped));console.log(`in zip created by Zip streams: ${files.length} files found`);}});for(const[fileName,content]ofentries){constfile=newfflate.ZipPassThrough(fileName);zip.add(file);file.push(content,true);}zip.end();}/*in zip created by zipSync function: 4464 files foundin zip created by zip async function: 4464 files foundin zip created by Zip streams: 4464 files found*/
Currently, when saving a .zip file containing more than 65,535 files, a corrupted archive is created - some 3rd party software cannot properly find all files, fflate itself is no exception!
This is caused by overflow of the 16 bits intended for information of the number of files in the standard EOCD record. fflate v0.8.2 is able to read Zip64 EOCD record/locator, but is unable of writing such data.
related #137 (unzip does not support >65,535 files)
@101arrowz thank you for your time and this library, much appreciated!
The text was updated successfully, but these errors were encountered:
Zip
class streams,zip
andzipSync
functions do not correctly support saving a .zip file with more than 65,535 file entries.How to reproduce
node:
browser:
https://jsfiddle.net/uo568c9a/
The problem
Currently, when saving a .zip file containing more than 65,535 files, a corrupted archive is created - some 3rd party software cannot properly find all files, fflate itself is no exception!
This is caused by overflow of the 16 bits intended for information of the number of files in the standard EOCD record.
fflate v0.8.2
is able to read Zip64 EOCD record/locator, but is unable of writing such data.related #137 (unzip does not support >65,535 files)
@101arrowz thank you for your time and this library, much appreciated!
The text was updated successfully, but these errors were encountered: