Open
Conversation
nhz2
suggested changes
Nov 10, 2023
nhz2
left a comment
There was a problem hiding this comment.
This needs added tests to ensure files written with these different options can be read correctly.
| if f.method == Deflate | ||
| f._zio = Zlib.Writer(f._io, true) | ||
| if f.method == Deflate || !isnothing(deflate_level) | ||
| f._zio = Zlib.Writer(f._io, something(deflate_level, 6), true) |
There was a problem hiding this comment.
If the f.method is being changed to Deflate here, this must also be recorded when writing the local and central directory record. See lines 630, and 424. Otherwise reading will fail.
Also, if the compression level is changed, the general purpose bit flag should also be changed.
And https://github.com/madler/zipflow/blob/2bef2123ebe519c17b18d2d0c3c71065088de952/zipflow.c#L214
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change adds a
deflate_levelparameter when adding a file, with the default value of 6. The hard-coded value of 9 has significant performance penalty and can be several times slower for only a minimal decrease in file size.