mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-02-13 13:35:28 +00:00
[PR #1132] [MERGED] Clean up for async creation #1562
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/1132
Author: @adamhathcock
Created: 1/15/2026
Status: ✅ Merged
Merged: 1/27/2026
Merged by: @adamhathcock
Base:
master← Head:adam/async-creation📝 Commits (10+)
a410f73archive asyncs are more right2d597e6be more lazy with loading of sync stuff33b6447Merge remote-tracking branch 'origin/master' into adam/async-creation63736efMerge remote-tracking branch 'origin/master' into adam/async-creation810df8arevert lazy archive5c06b8cenable single test0b2158fInitial planbbba2e6Initial plan for fixing SevenZipArchive_LZMA_AsyncStreamExtraction test9bb670aFix SevenZipArchive async stream handling by adding async Open and ReadDatabase methods491beabuncomment tests📊 Changes
339 files changed (+17782 additions, -6732 deletions)
View changed files
📝
AGENTS.md(+55 -0)📝
Directory.Packages.props(+1 -1)➕
src/SharpCompress/Archives/AbstractArchive.Async.cs(+103 -0)📝
src/SharpCompress/Archives/AbstractArchive.cs(+5 -92)➕
src/SharpCompress/Archives/AbstractWritableArchive.Async.cs(+123 -0)📝
src/SharpCompress/Archives/AbstractWritableArchive.cs(+23 -17)➕
src/SharpCompress/Archives/ArchiveFactory.Async.cs(+158 -0)📝
src/SharpCompress/Archives/ArchiveFactory.cs(+10 -135)📝
src/SharpCompress/Archives/ArchiveVolumeFactory.cs(+5 -0)➖
src/SharpCompress/Archives/AutoArchiveFactory.cs(+0 -52)➕
src/SharpCompress/Archives/GZip/GZipArchive.Async.cs(+86 -0)📝
src/SharpCompress/Archives/GZip/GZipArchive.Factory.cs(+13 -9)📝
src/SharpCompress/Archives/GZip/GZipArchive.cs(+0 -53)📝
src/SharpCompress/Archives/IArchiveFactory.cs(+1 -5)📝
src/SharpCompress/Archives/IAsyncArchiveExtensions.cs(+2 -2)📝
src/SharpCompress/Archives/IWritableArchive.cs(+34 -8)➖
src/SharpCompress/Archives/IWritableArchiveCommonExtensions.cs(+0 -59)📝
src/SharpCompress/Archives/IWritableArchiveExtensions.cs(+50 -0)📝
src/SharpCompress/Archives/IWritableAsyncArchiveExtensions.cs(+50 -0)📝
src/SharpCompress/Archives/Rar/FileInfoRarArchiveVolume.cs(+3 -0)...and 80 more files
📄 Description
For some formats, async should be all the way. 7Zip needs fixing
This pull request introduces asynchronous detection methods for multiple archive and compression formats, allowing non-blocking checks to determine file types. It also refactors and simplifies some synchronous detection logic for improved performance and consistency. The most significant changes are grouped below:
Asynchronous Format Detection:
Added
IsArchiveAsyncor similar async methods for ACE (AceHeader.cs), ARJ (ArjHeader.cs), BZip2 (BZip2Stream.cs), LZip (LZipStream.cs), LZW (LzwStream.cs), ZStandard (ZStandardStream.cs), RAR (RarArchive.Factory.cs), SevenZip (SevenZipArchive.Factory.cs), TAR (TarArchive.Factory.cs), and XZ (XZStream.cs) formats, enabling asynchronous file type checks withCancellationTokensupport. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]Updated the ACE and ARJ factories to implement and expose these new asynchronous detection methods. [1] [2]
Synchronous Detection Refactoring & Performance:
ArrayPool<byte>.Shared) for ARC and SevenZip formats, reducing allocations and improving performance. [1] [2]API Consistency and Interface Changes:
CancellationTokenparameter from theIArchiveFactory.OpenAsyncArchivemethod and its implementations to simplify the API, as the token was not being used in actual asynchronous operations. [1] [2] [3]General Codebase Improvements:
usingdirectives forSystem.ThreadingandSystem.Threading.Taskswhere needed to support the new asynchronous methods. [1] [2] [3] [4] [5] [6] [7]These changes collectively modernize the archive/compression format detection APIs and improve their efficiency and usability.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.