Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve user experience: change compression method to deflate #348

Closed
wants to merge 2 commits into from

Conversation

MrPans
Copy link

@MrPans MrPans commented Jan 9, 2025

Fixes

Changes proposed in this PR

  • Change the default argument compressionMethod to .deflate at zipItem(at:to:shouldKeepParent:compressionMethod:progress)

Tests performed

true

Further info for the reviewer

In the software development industry, it’s a widely accepted convention for libraries to default to a “compressed” output rather than “uncompressed.” For instance, popular libraries like ZipArchive and minizip are designed so that when users provide a source URL and a destination URL, the output at the destination is a compressed zip file by default. This aligns with user expectations and typical workflows.

Currently, ZipFoundation’s default setting is .none, which generates an uncompressed zip. While this is a valid design choice, it may cause confusion for users who assume the output will follow the standard behavior seen in similar libraries. In most practical use cases, whether in daily development or production environments, users are looking to create a compressed zip file rather than one that is simply a copy of the input.

To provide a smoother user experience and align with industry best practices, I would suggest changing the default value to .deflate. This small adjustment could make the library more intuitive and user-friendly.

Open Issues
none

MrPans added 2 commits January 8, 2025 22:23
Improve user experience: change compression method to deflate
Improve user experience: change default compression method to deflate
@weichsel
Copy link
Owner

To provide a smoother user experience and align with industry best practices, I would suggest changing the default value to .deflate. This small adjustment could make the library more intuitive and user-friendly.

MrPans, thanks for your PR!

I understand that compress-by-default might be more intuitive but when originally designing this API, as was trying to stick as close to the ZIP APPNOTE (spec) as possible. The format is foremost an archiving (vs. compression) format there. .deflate and various other compression algorithms were added over time.

Changing the default now would significantly change the performance characteristics of the library and some users might run into unexpected changes. So I'll leave it as-is.

@weichsel weichsel closed this Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants