- Support adding directory contents at the top level of the
ZipStream
by specifying an arcname of/
- Fix issue where leading path separators could cause an incorrect size to be calculated.
- Fix issue where it was possible to add paths with arcnames that didn't match the path contents (file ending with "/", directory not ending with "/")
- Add the ability to get information on added files using
ZipStream.info_list
. This function replacesZipStream.get_info
which would only provide information on files that had already been streamed. - Deprecate
ZipStream.get_info
. It will continue to work until the next major version but will now emit a warning when used. - Reduce memory usage for sized
ZipStream
objects by updating the final size of the stream as files are added instead of storing the required information so the size could be calculated later.
- Add the ability to provide a custom "walk" function to
ZipStream.add_path
for more control over how directories are walked. - Change the exception raised when trying to add a file that doesn't exist from a
ValueError
to a more appropriateFileNotFoundError
. - Optimize the number of
os.stat
calls required to add a file. - Fix issue where adding data with an arcname that contained a null byte would lead to an incorrect size being calculated.
- When
ZipStream.add
is provided a size alongside an iterable, the size will now be used to determine if Zip64 extensions are needed.
- Add
ZipStream.mkdir
method to make an empty directory inside the stream. - Fix an issue where
ZipStream.get_info
would return incorrect values forcompress_level
in cases where the compression level was specified, but had no effect (ie. when usingZIP_STORED
/ZIP_LZMA
). - Fix an edge case where top-level paths like
/
could be added with an empty arcname. - Improve error messages for adding data as a directory and adding nonexistent paths.
- The expected size of data added to a
ZipStream
is now validated as it's generated. For unsizedZipStream
s a mismatch in expected vs. actual size emits a warning, for sizedZipStream
s aRuntimeError
is raised. - For sized
ZipStream
s, add the option to provide the total size of an iterable when adding it. When the size is provided, the iterable will no longer have to immediately be read into memory to compute it.
- Fix issue where adding data via an iterable to an unsized
ZipStream
wouldn't fully implement Zip64 extensions. This caused some versions of7z
to emit warnings (but still properly extract the data).
- Fix issue where adding files with multibyte characters in the filename would lead to an incorrect zip size being calculated.
- Fix issue where directly adding an empty folder would give it the wrong name in the archive and lead to an incorrect zip size being calculated.
- Fix documentation issue caused by the import shuffling in v1.3.1
- Set external attributes (permissions, directory flag, etc) on data added to the
ZipStream
viaadd()
- Allow importing functionality from
zipstream.ng
as well aszipstream
to avoid namespace collisions with other projects that provide azipstream
module.
- Add a
last_modified
property toZipStream
objects that returns adatetime
of the most recent modified date of all the files in the stream.
- Fix issue where adding empty directories would lead to an incorrect zip size being calculated.
- Fix issue where asking for the
ZipStream
's size multiple times while adding data wouldn't properly check if Zip64 extensions were being used, causing an incorrect size to be calculated.
- Add a
sized
property toZipStream
objects that checks if the size can be calculated for it - Change
ZipStream.from_path
to generate a sizedZipStream
if no compression is used
- Add support for Python 3.5 and 3.6
- Initial version