Skip to content

Conversation

@adamhathcock
Copy link
Owner

@adamhathcock adamhathcock commented Oct 27, 2025

This pull request adds asynchronous support for saving and extracting archives in the SharpCompress library. It introduces new async methods for writing archive entries and saving entire archives, enabling non-blocking I/O operations and cancellation support. The changes span core archive types (Zip, Tar, GZip), extension methods, and add comprehensive async extraction capabilities.

Async archive saving and extraction:

  • Added SaveToAsync methods to IWritableArchive, AbstractWritableArchive, and their extension classes, allowing archives to be saved asynchronously to streams and files with cancellation support. [1] [2] [3]
  • Implemented SaveToAsync overrides for ZipArchive, TarArchive, and GZipArchive to asynchronously write archive entries using their respective writers. [1] [2] [3]

Async entry extraction:

  • Added WriteToAsync, WriteToDirectoryAsync, and WriteToFileAsync extension methods to IArchiveEntryExtensions, enabling asynchronous extraction of archive entries to streams, directories, or files. [1] [2] [3]

Async writer support:

  • Extended TarWriter with WriteAsync methods for writing entries asynchronously, supporting progress, cancellation, and stream size validation.

Testing improvements:

  • Added async test helpers in ArchiveTests.cs to verify asynchronous archive extraction and ensure correctness of the new async APIs.

These changes modernize the library for better scalability and responsiveness in applications that use SharpCompress for large or remote archives.

@adamhathcock adamhathcock requested a review from Copilot October 27, 2025 10:32
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces comprehensive async support for archive operations in SharpCompress, enabling non-blocking save and extraction functionality across GZip, Tar, and Zip archive types. The changes modernize the API to support async/await patterns throughout the library.

Key Changes:

  • Added SaveToAsync methods to IWritableArchive and concrete archive implementations (GZipArchive, TarArchive, ZipArchive)
  • Introduced WriteToAsync and WriteToFileAsync extension methods for IArchiveEntry to support async extraction
  • Created comprehensive async unit tests for GZip archives to validate the new async functionality

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/SharpCompress/Archives/IWritableArchive.cs Added SaveToAsync method signature to interface
src/SharpCompress/Archives/IWritableArchiveExtensions.cs Added async extension methods for saving archives to files and streams
src/SharpCompress/Archives/AbstractWritableArchive.cs Implemented base SaveToAsync method and added abstract method for derived classes
src/SharpCompress/Archives/GZip/GZipArchive.cs Implemented SaveToAsync with GZip-specific logic and file overloads
src/SharpCompress/Archives/Tar/TarArchive.cs Implemented SaveToAsync for Tar archives
src/SharpCompress/Archives/Zip/ZipArchive.cs Implemented SaveToAsync for Zip archives
src/SharpCompress/Archives/IArchiveEntryExtensions.cs Added WriteToAsync and WriteToFileAsync for async entry extraction
tests/SharpCompress.Test/GZip/GZipArchiveAsyncTests.cs Added async test coverage for GZip archive operations
tests/SharpCompress.Test/GZip/GZipWriterAsyncTests.cs Added async test coverage for GZip writer operations

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@adamhathcock adamhathcock merged commit 25b297b into master Oct 27, 2025
2 checks passed
@adamhathcock adamhathcock deleted the async-gzip-tests branch October 27, 2025 10:54
@adamhathcock adamhathcock mentioned this pull request Oct 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants