[PR #934] [MERGED] Zip ZStandard Writing with tests. Level support. #1357

Open
opened 2026-01-29 22:20:09 +00:00 by claunia · 0 comments
Owner

📋 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: masterHead: feature/zstd_zip_writing


📝 Commits (8)

  • c5de3d8 Zip ZStandard Writing with tests. Level support.
  • e9dd413 CSharpier formatting.
  • b7f5b36 Update src/SharpCompress/Writers/Zip/ZipWriter.cs
  • 5cbb31c Update tests/SharpCompress.Test/Zip/TestPseudoTextStream.cs
  • d15816f Update tests/SharpCompress.Test/Zip/TestPseudoTextStream.cs
  • ae311ea Update tests/SharpCompress.Test/Zip/TestPseudoTextStream.cs
  • 7769435 CSharpier fixes after copilot tweaks.
  • 8a0152f Fixed 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.

## 📋 Pull Request Information **Original PR:** https://github.com/adamhathcock/sharpcompress/pull/934 **Author:** [@Nanook](https://github.com/Nanook) **Created:** 7/24/2025 **Status:** ✅ Merged **Merged:** 7/24/2025 **Merged by:** [@adamhathcock](https://github.com/adamhathcock) **Base:** `master` ← **Head:** `feature/zstd_zip_writing` --- ### 📝 Commits (8) - [`c5de3d8`](https://github.com/adamhathcock/sharpcompress/commit/c5de3d8cc17b6db581a250ed2b6818f7abc23dce) Zip ZStandard Writing with tests. Level support. - [`e9dd413`](https://github.com/adamhathcock/sharpcompress/commit/e9dd413de61ff8f77615318bea4b814ad3327c7e) CSharpier formatting. - [`b7f5b36`](https://github.com/adamhathcock/sharpcompress/commit/b7f5b36f2b488ac2fb418ff5bdf04bd17e1c22bb) Update src/SharpCompress/Writers/Zip/ZipWriter.cs - [`5cbb31c`](https://github.com/adamhathcock/sharpcompress/commit/5cbb31c559ff6eba9b8dec4dd85964b15c8f1f67) Update tests/SharpCompress.Test/Zip/TestPseudoTextStream.cs - [`d15816f`](https://github.com/adamhathcock/sharpcompress/commit/d15816f16244b451e89510c686fef150939604a6) Update tests/SharpCompress.Test/Zip/TestPseudoTextStream.cs - [`ae311ea`](https://github.com/adamhathcock/sharpcompress/commit/ae311ea66e4f8779d494bbf1cf1c893498199f34) Update tests/SharpCompress.Test/Zip/TestPseudoTextStream.cs - [`7769435`](https://github.com/adamhathcock/sharpcompress/commit/7769435fc828c67d9ddd4bb312839c9448bd0f2d) CSharpier fixes after copilot tweaks. - [`8a0152f`](https://github.com/adamhathcock/sharpcompress/commit/8a0152fe7c989acc6f71ee1f4bb7745d6b47a2ff) Fixed up test issue after copilot "fixes" :S. ### 📊 Changes **13 files changed** (+681 additions, -28 deletions) <details> <summary>View changed files</summary> 📝 `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) </details> ### 📄 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 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 22:20:09 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/sharpcompress#1357