support optional crc32 for uncompressed streaming zip32 and zip64#134
support optional crc32 for uncompressed streaming zip32 and zip64#134ikreymer wants to merge 3 commits into
Conversation
- if crc32 value passed in is 0, then include data descriptor record with actual length and crc32
…pressing with stream_unzip
|
Interesting... will have more of a look around and ponder. Some initial thoughts/questions/requests on this:
My biggest concern is the spec thing... |
|
To communicate, I am more and more anti this because it results in ZIP files that do not adhere to the spec. Even if we test a load of existing unzippers, it's not very friendly to future unzippers that expect files to adhere to the spec, or even new versions of existing unzippers that make changes expecting them to be fine because of the spec |
This PR implements the idea originally discussed in #17 and #58, producing ZIP files with actual length in local header and 0 crc32, and including a data descriptor with the length and actual crc32.
This allows specifying ZIP file members with
NO_COMPRESSION_64(file_size, 0)andNO_COMPRESSION_32(file_size, 0)and does not raise the invalid crc32 exception, but instead computes it and stores it in the data descriptor.The ZIP files produces with this implementation should:
unzip -tteststream_unzip(according to my testing) without any additional changes. I believe this was the main objection to the ideas in Support streaming with NO_COMPRESSION_64 and NO_COMPRESSION_32 #58, since discussion was about making both length and crc32 optional, now only, crc32 is.This would really help our use case to be able to support this without having a custom fork.
The main use case is being able to stream-zip files from S3-like buckets where the size is available, but crc-32 usually is not (also mentioned in #17)