mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-02-14 21:23:38 +00:00
[PR #1092] Add dual sync/async support for Zip headers and IsArchive async overloads #1524
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?
Original Pull Request: https://github.com/adamhathcock/sharpcompress/pull/1092
State: closed
Merged: No
Updates all Zip header classes to support both synchronous and asynchronous reading paths while maintaining backward compatibility. Adds async overloads for archive detection methods to enable proper async-only stream support.
Changes Made
Zip Headers - Dual Sync/Async Support
ZipHeaderbase class to define bothRead(BinaryReader)andRead(AsyncBinaryReader)abstract methodsZipHeaderFactoryandSeekableZipHeaderFactoryprovide both sync and asyncReadHeadermethodsZipArchive.LoadEntries) continue to work unchangedIsArchive Async Overloads
IsArchiveAsyncmethod toIFactoryinterface with default implementationIsZipFileAsyncandIsZipMultiAsyncmethods toZipArchivefor async archive format detectionIsGZipFileAsyncmethod toGZipArchiveusingReadFullyAsyncutilityZipFactoryandGZipFactoryoverrideIsArchiveAsyncto use async detection methodsReaderFactory.OpenAsyncto callIsArchiveAsyncinstead ofIsArchivefor proper async-only stream supportAsyncBinaryReader
Test Fixes
Zip_Reader_Disposal_Test2_Asyncto useReaderFactory.OpenAsyncReadAsyncoverrides to properly forward async calls to underlying streamBenefits
The implementation provides true async support for Zip and GZip archive detection and reading, allowing the use of async-only streams throughout the library while maintaining full backward compatibility with synchronous code paths.
Original prompt
Created from VS Code.
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.