mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-02-17 21:23:27 +00:00
[PR #1092] [CLOSED] Add dual sync/async support for Zip headers and IsArchive async overloads #1521
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/1092
Author: @Copilot
Created: 12/30/2025
Status: ❌ Closed
Base:
master← Head:copilot/add-buffered-stream-async-read📝 Commits (10+)
7c3c94eAdd ArcReaderAsync tests3bdaba4fmtfb76bd8first commit of async reader1607d27Merge branch 'master' into adam/async-binary-reader8415a19Initial planaf71970Merge branch 'adam/async-binary-reader' into copilot/add-buffered-stream-async-read39a0b4cUse BufferedStream for async reading in AsyncBinaryReaderec31cb9Fix Zip headers to support both sync and async reading6e0e20bFix zip64_locator to use ReadUInt32Async instead of ReadUInt16Async038b9f1Merge remote-tracking branch 'origin/master' into copilot/add-buffered-stream-async-read📊 Changes
46 files changed (+1995 additions, -57 deletions)
View changed files
📝
src/SharpCompress/Archives/ArchiveFactory.cs(+126 -0)📝
src/SharpCompress/Archives/AutoArchiveFactory.cs(+21 -0)📝
src/SharpCompress/Archives/GZip/GZipArchive.cs(+86 -0)📝
src/SharpCompress/Archives/IArchiveFactory.cs(+26 -0)📝
src/SharpCompress/Archives/IMultiArchiveFactory.cs(+26 -0)📝
src/SharpCompress/Archives/Rar/RarArchive.cs(+66 -0)📝
src/SharpCompress/Archives/SevenZip/SevenZipArchive.cs(+64 -0)📝
src/SharpCompress/Archives/Tar/TarArchive.cs(+64 -0)📝
src/SharpCompress/Archives/Zip/ZipArchive.cs(+154 -2)➕
src/SharpCompress/Common/AsyncBinaryReader.cs(+117 -0)📝
src/SharpCompress/Common/FilePart.cs(+6 -0)📝
src/SharpCompress/Common/Zip/Headers/DirectoryEndHeader.cs(+13 -0)📝
src/SharpCompress/Common/Zip/Headers/DirectoryEntryHeader.cs(+32 -1)📝
src/SharpCompress/Common/Zip/Headers/IgnoreHeader.cs(+3 -0)📝
src/SharpCompress/Common/Zip/Headers/LocalEntryHeader.cs(+26 -5)📝
src/SharpCompress/Common/Zip/Headers/SplitHeader.cs(+4 -0)📝
src/SharpCompress/Common/Zip/Headers/Zip64DirectoryEndHeader.cs(+20 -0)📝
src/SharpCompress/Common/Zip/Headers/Zip64DirectoryEndLocatorHeader.cs(+9 -4)📝
src/SharpCompress/Common/Zip/Headers/ZipFileEntry.cs(+24 -10)📝
src/SharpCompress/Common/Zip/Headers/ZipHeader.cs(+5 -9)...and 26 more files
📄 Description
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.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.