I have difficult to understand the difference between zipfile.ZIP_DEFLATED and zipfile.ZIP_STORED compression modes of the zipfile module.
Someone could help me?
thanks,
Max
ZIP_STORED. The numeric constant for an uncompressed archive member. zipfile. ZIP_DEFLATED. The numeric constant for the usual ZIP compression method.
ZIP is an archive file format that supports lossless data compression. A ZIP file may contain one or more files or directories that may have been compressed. The ZIP file format permits a number of compression algorithms, though DEFLATE is the most common.
with ZipFile(file_name, 'r') as zip: Here, a ZipFile object is made by calling ZipFile constructor which accepts zip file name and mode parameters. We create a ZipFile object in READ mode and name it as zip.
The zipfile. ZipFile() function is equivalent to the open() function; the first argument is the filename, and the second argument is the mode to open the ZIP file in (read, write, or append).
ZIP_DEFLATED
correspond to an archive member (a file inside the archive) which is compressed (or deflated). ZIP_STORED
correspond to an archive member which is simply stored, without being compressed, quite the same as an archive member inside a tar
file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With