Cancel ZIP archive creation
It may happen you want to cancel zip archive creation for various reasons. It just can take too long or you do not actually need some entries there.
Canceling long archive creation
Lets say you want your ZIP archive to be composed in about a minute. After some entry has been compressed check the time taken from the beginning of compression, and if it took more than a minute, cancel the process. The result archive would have already compressed entries including the one triggred the event.
Canceling after certain entry
If you want to cancel after particular entry has been compressed use following snippet: