mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-02-04 05:25:00 +00:00
[PR #750] [MERGED] Add fast ExtractToDirectoryAsync extension method on IArchive
#1203
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/750
Author: @FlsZen
Created: 7/19/2023
Status: ✅ Merged
Merged: 9/7/2023
Merged by: @adamhathcock
Base:
master← Head:master📝 Commits (3)
c7c143fAddExtractToDirectoryAsyncextension method onIArchivethat is very fast compared toWriteToDirectory.4e23b84Remove Task aspectec01225It looks like build format wants this on one line📊 Changes
1 file changed (+55 additions, -0 deletions)
View changed files
📝
src/SharpCompress/Archives/IArchiveExtensions.cs(+55 -0)📄 Description
As mentioned in #728 (and I believe some other issues), the
IArchive.WriteToDirectory(...)extension method can be very slow for.7zfiles. This extension utilizedIArchive.ExtractAllEntries()andIReaderso is fast for .7z files.Being async has nothing to do with the performance, rather, it's because I use this extension method from an async method and need it to perform the long-running work asynchronously. Ideally
IArchive.ExtractAllEntries()andIReader.WriteEntryTo(Stream)would be async as well and then the whole Task.Run wouldn't be needed and then it would make more sense to be async.It currently doesn't support
ExtractionOptionsor reporting progress throughIArchive's events (although it does report progress through a callback). But, it works great as-is for my use case, which I suspect is pretty common, and I wanted to share.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.