weichsel / ZIPFoundation

Effortless ZIP Handling in Swift
MIT License
2.31k stars 255 forks source link

Support splitting zips into multiple files #312

Open ehemmete opened 6 months ago

ehemmete commented 6 months ago

I am working on a tool for my team to prep files for upload to cloud services as an archive. One of the steps is to turn bundle file types (.aplibrary, .fcpbundle, etc) into a single file for upload so the bundle flag doesn't get broken. However, some of these bundles are huge and even compressed are too large to upload.

I would like to be able to specify a max file size and that the tool create as many files as needed to archive the original in chunks up to max size.

Currently I am trying to use Process to run the built in /usr/bin/zip which can work, but is annoying and not very swifty. i.e. /usr/bin/zip -r -s 150g "(fileURL.path).zip", fileURL.lastPathComponent

It looks like the built in zip in macOS 13 & 14 is Info-ZIP https://infozip.sourceforge.net The ouput is a set of files like: filename.z01 filename.z02 filename.z03 filename.zip

The Unarchiver (https://theunarchiver.com) knows how to unzip these even though the built in Archive Utility doesn't.

weichsel commented 5 months ago

ZIP Foundation currently doesn't support splitting ZIP files. If you can provide a PR that implements this feature (as outlined in section 8.0 of the ZIP APPNOTE: https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT), I can help to review and integrate it into the library.