mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-02-11 13:35:00 +00:00
[PR #934] [MERGED] Zip ZStandard Writing with tests. Level support. #1357
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/adamhathcock/sharpcompress/pull/934
Author: @Nanook
Created: 7/24/2025
Status: ✅ Merged
Merged: 7/24/2025
Merged by: @adamhathcock
Base:
master← Head:feature/zstd_zip_writing📝 Commits (8)
c5de3d8Zip ZStandard Writing with tests. Level support.e9dd413CSharpier formatting.b7f5b36Update src/SharpCompress/Writers/Zip/ZipWriter.cs5cbb31cUpdate tests/SharpCompress.Test/Zip/TestPseudoTextStream.csd15816fUpdate tests/SharpCompress.Test/Zip/TestPseudoTextStream.csae311eaUpdate tests/SharpCompress.Test/Zip/TestPseudoTextStream.cs7769435CSharpier fixes after copilot tweaks.8a0152fFixed up test issue after copilot "fixes" :S.📊 Changes
13 files changed (+681 additions, -28 deletions)
View changed files
📝
src/SharpCompress/Common/CompressionType.cs(+1 -0)📝
src/SharpCompress/Common/Zip/ZipCompressionMethod.cs(+1 -1)📝
src/SharpCompress/Common/Zip/ZipEntry.cs(+1 -0)📝
src/SharpCompress/Common/Zip/ZipFilePart.cs(+1 -1)📝
src/SharpCompress/Writers/GZip/GZipWriter.cs(+1 -1)📝
src/SharpCompress/Writers/GZip/GZipWriterOptions.cs(+4 -10)📝
src/SharpCompress/Writers/WriterOptions.cs(+30 -2)📝
src/SharpCompress/Writers/Zip/ZipWriter.cs(+15 -6)📝
src/SharpCompress/Writers/Zip/ZipWriterEntryOptions.cs(+27 -2)📝
src/SharpCompress/Writers/Zip/ZipWriterOptions.cs(+48 -5)📝
tests/SharpCompress.Test/ArchiveTests.cs(+218 -0)➕
tests/SharpCompress.Test/Zip/TestPseudoTextStream.cs(+99 -0)➕
tests/SharpCompress.Test/Zip/ZipMemoryArchiveWithCrcTests.cs(+235 -0)📄 Description
Add ZStandard compression support and enhanced Zip creation tests
This PR introduces ZStandard compression support for ZIP archives with configurable compression levels, along with comprehensive test coverage for various compression algorithms and performance validation.
Key Changes:
• ZStandard ZIP Support: Added ZStandard compression capability with full compression level control
• Enhanced CompressionLevel API: Updated WriterOptions.CompressionLevel to use int type, enabling support for various compression algorithms with different level ranges (e.g., ZStandard levels 1-22, Deflate levels 1-9)
• Backward Compatibility: All changes maintain backward compatibility with existing APIs
New Test Coverage:
• Comprehensive Zip Creation Tests: Added extensive test suite using a deterministic pseudo-text stream generator
• Multi-Algorithm Testing: Tests cover Deflate, ZStandard, BZip2, LZMA, and uncompressed scenarios
• Compression Level Validation: Validates compression effectiveness across different levels with realistic ratio expectations
• Large File Testing: Tests with multi-megabyte files to exercise IStackStream buffering and rewind capabilities more thoroughly
• CRC32 Verification: All tests include end-to-end CRC32 validation to ensure data integrity
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.