Welcome to the Monastery | |
PerlMonks |
Re^2: Archive::Zip can only create zip-files in-memory, right?by pmqs (Friar) |
on Jul 26, 2014 at 16:19 UTC ( [id://1095166]=note: print w/replies, xml ) | Need Help?? |
Archive::Zip will "remember" all the actions you request done for the zip file, then do all of them in sequence when you do
So if you are creating a zip based on real files from the filesystem, the contents of those files are not stored in memory. It just remembers the names of the files in memory. When you do make the writeToFileNamed call it reads the input files and writes the compressed data directly to the output filehandle for the zip file. Regarding Archive::Zip::SimpleZip - it does write to the zip file as soon as possible. One thing to be aware of though - the zip container format that gets used by 99% of all zip archives out in the wild needs to be written to a seekable filehandle when you are using Archive::Zip::SimpleZip. STDOUT is not seekable. Luckily, the Zip container spec does support a proper streaming format that can be used when writing to STDOUT. The issue then is to ensure that the client supports that type of Zip container. Most do these days. If you use Archive::Zip::SimpleZip with STDOUT, it will automatically create a streamed zip container. Whether that is acceptable depends on your clients. If you think there is an issue with member naming in Archive::Zip::SimpleZip I'd like to hear what is missing.
In Section
Seekers of Perl Wisdom
|
|