zip.CloseArchive(id[, discard, callback, userdata])
zip.CloseArchive()
marks the point when compressing
and writing the data will actually happen. That's why it can take some time
for this function to return.
If you want to discard all changes that have been made to the zip archive,
you have to pass True
in the discard
parameter. In that case, the original
zip archive isn't modified and all changes are discarded. This is also what
will happen to all zip archives which you open using zip.OpenArchive()
but forget to close using zip.CloseArchive()
. Changes will only ever be written
to the zip archive if you explicitly call zip.CloseArchive()
with discard
being False
.
If you'd like to monitor the progress of compressing data and writing it to
the zip archive, you can pass a callback function in the second parameter.
Optionally, it is also possible to specify user data to pass to the callback
function in their third argument. The userdata
parameter can take values of
any type: Numbers, strings, tables, and even functions can be passed as user
data.
The status callback function receives a single table element that contains the following fields:
Action:
ID:
Progress:
UserData:
userdata
argument.
Obviously, if discard
is set to True
, the callback function will never
be called.
True
to discard all changes, False
to write all
changes to the zip archive (defaults to False
)