-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Welcome to the ZZipUpdate wiki!
Alex Zvenigorodsky
I'm very interested in hearing from anyone that's able to make use of this code or utility. Despite being a software engineer for a long time this is my first contribution to the Open Source Community, so I would love feedback.
Please free to email questions, comments: alexz@azvenigo.com Or tweet: @azvenigo
I have found a few things missing in all commonly available zip utilities. While they focus on having robust collections of codecs, UIs, etc. None would let me view or extract individual files from enormous zip files on a server. I would have to download the entire thing first.
I also found that most utilities were written in the days of physical hard drives where seek time was a major bottleneck in throughput. With SSDs that's no longer the case, so it made sense to support multithreaded extraction.
And something else that I had wanted was to be able to have a simple but fast utility for an application to be able to self-update. Many platforms already support keeping applications up to date, but these frequently have a lot of prerequisites for publishing. I wanted for an application to be able to self-update with minimal requirements.
The following will download any files missing or different from c:/example that are in the package:
ZZipUpdate.exe sync https://www.mysecuresite.com/latest/files.zip c:/example
The following will extract all jpg files with 8 threads:
ZZipUpdate.exe extract d:/downloads/pictures.zip c:/albums *.jpg -threads:8
The following will report differences between a path and a package and create an HTML report called results.html:
ZZipUpdate.exe diff http://www.mysite.com/game_1.5.2.zip "c:/Program Files (x86)/Game/" -outputformat:html > results.html
The following will list the contents of a zip file on a server in a comma delimited format
ZZipUpdate.exe list https://www.mysite.com/sample.zip -outputformat:commas
The following will create a new zip archive and all JPG files that contain "Maui" in the specified path:
ZZipUpdate.exe create c:/temp/mytrip.zip "f:\My Albums\2019\Hawaii Trip\" *Maui*.jpg
There are several ways in which you can use these classes. At the highest level you can instantiate a ZZipJob object, configure it and let it run. Querying it for status or calling Join when you want to wait for it to complete.
ZipJob newJob(ZipJob::kExtract);
newJob.SetBaseFolder(L"c:/output");
newJob.SetURL(L"c:/downloads/files.zip");
newJob.Run();
newJob.Join();
You can also use ZZipAPI directly. For example you can retrieve a file from a zip archive on a server directly into memory:
ZZipAPI zipAPI;
zipAPI.Init(L"http://www.sample.net/files.zip");
zipAPI.DecompressToBuffer("readme.txt", pOutputBuffer);
Building a self update feature into an application can time consuming and error prone. The simplest approach is to have an application check a server for a newer version; and if available to download a new setup package and run it. While this is safe this can take significantly longer than necessary for your user.
Instead consider using ZZipUpdate's methods:
- Publish your application's installer and a zip version of the application next to it. For example:
- Add a launcher to your application to call ZZipUpdate.exe for self update.
- Whenever your application is launched call ZZipUpdate.exe with your zip package and your install path.
- Example command line for self update:
ZZipUpdate.exe sync https://myserver/app_package.zip "c:\Program Files\My Application"
ZZipUpdate will extract the zip central directory and check all your local files for anything that isn't up to date or missing and download the minimum required files. Even on reasonably large applications this may only take a few seconds which is reasonable for startup times. If you wish you could also add a version check before launching ZZipUpdate to save the few seconds.
- Follow method 1 but publish your application's installer as a self-extracting ZIP file.
- "https://myserver/app_installer.exe"
- Example command line for self update:
ZZipUpdate.exe sync https://myserver/app_package.exe "c:\Program Files\My Application"
ZZipUpdate can work with self-extracting zip files and you can specify the EXE as a package.