[PR #980] [MERGED] adds more async tests and overloads to make things writable and async #1395

Open
opened 2026-01-29 22:20:22 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/adamhathcock/sharpcompress/pull/980
Author: @adamhathcock
Created: 10/27/2025
Status: Merged
Merged: 10/27/2025
Merged by: @adamhathcock

Base: masterHead: async-gzip-tests


📝 Commits (5)

  • f21b982 adds more async tests and overloads to make things writable and async
  • 9af3520 Merge branch 'master' into async-gzip-tests
  • 1618241 add tar specific tests
  • 9c18daa Merge remote-tracking branch 'origin/async-gzip-tests' into async-gzip-tests
  • ab03c12 add more tests

📊 Changes

16 files changed (+1189 additions, -0 deletions)

View changed files

📝 src/SharpCompress/Archives/AbstractWritableArchive.cs (+22 -0)
📝 src/SharpCompress/Archives/GZip/GZipArchive.cs (+34 -0)
📝 src/SharpCompress/Archives/IArchiveEntryExtensions.cs (+67 -0)
📝 src/SharpCompress/Archives/IWritableArchive.cs (+8 -0)
📝 src/SharpCompress/Archives/IWritableArchiveExtensions.cs (+20 -0)
📝 src/SharpCompress/Archives/Tar/TarArchive.cs (+26 -0)
📝 src/SharpCompress/Archives/Zip/ZipArchive.cs (+20 -0)
📝 src/SharpCompress/Writers/Tar/TarWriter.cs (+36 -0)
📝 tests/SharpCompress.Test/ArchiveTests.cs (+53 -0)
tests/SharpCompress.Test/GZip/GZipArchiveAsyncTests.cs (+127 -0)
tests/SharpCompress.Test/GZip/GZipWriterAsyncTests.cs (+83 -0)
📝 tests/SharpCompress.Test/ReaderTests.cs (+68 -0)
tests/SharpCompress.Test/Tar/TarArchiveAsyncTests.cs (+223 -0)
tests/SharpCompress.Test/Tar/TarReaderAsyncTests.cs (+272 -0)
tests/SharpCompress.Test/Tar/TarWriterAsyncTests.cs (+83 -0)
📝 tests/SharpCompress.Test/WriterTests.cs (+47 -0)

📄 Description

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.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/adamhathcock/sharpcompress/pull/980 **Author:** [@adamhathcock](https://github.com/adamhathcock) **Created:** 10/27/2025 **Status:** ✅ Merged **Merged:** 10/27/2025 **Merged by:** [@adamhathcock](https://github.com/adamhathcock) **Base:** `master` ← **Head:** `async-gzip-tests` --- ### 📝 Commits (5) - [`f21b982`](https://github.com/adamhathcock/sharpcompress/commit/f21b982955922b52e1fd02e630ef02bc65dff474) adds more async tests and overloads to make things writable and async - [`9af3520`](https://github.com/adamhathcock/sharpcompress/commit/9af35201e43c1d9a3b05f91b47e626c7737bc454) Merge branch 'master' into async-gzip-tests - [`1618241`](https://github.com/adamhathcock/sharpcompress/commit/16182417fb7a623aacea6c1bf09dac4b8e004bc5) add tar specific tests - [`9c18daa`](https://github.com/adamhathcock/sharpcompress/commit/9c18daafb8ebfa21e36e939e3d716b216034c2eb) Merge remote-tracking branch 'origin/async-gzip-tests' into async-gzip-tests - [`ab03c12`](https://github.com/adamhathcock/sharpcompress/commit/ab03c12fa855d4013e470910dc84063997520e0d) add more tests ### 📊 Changes **16 files changed** (+1189 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `src/SharpCompress/Archives/AbstractWritableArchive.cs` (+22 -0) 📝 `src/SharpCompress/Archives/GZip/GZipArchive.cs` (+34 -0) 📝 `src/SharpCompress/Archives/IArchiveEntryExtensions.cs` (+67 -0) 📝 `src/SharpCompress/Archives/IWritableArchive.cs` (+8 -0) 📝 `src/SharpCompress/Archives/IWritableArchiveExtensions.cs` (+20 -0) 📝 `src/SharpCompress/Archives/Tar/TarArchive.cs` (+26 -0) 📝 `src/SharpCompress/Archives/Zip/ZipArchive.cs` (+20 -0) 📝 `src/SharpCompress/Writers/Tar/TarWriter.cs` (+36 -0) 📝 `tests/SharpCompress.Test/ArchiveTests.cs` (+53 -0) ➕ `tests/SharpCompress.Test/GZip/GZipArchiveAsyncTests.cs` (+127 -0) ➕ `tests/SharpCompress.Test/GZip/GZipWriterAsyncTests.cs` (+83 -0) 📝 `tests/SharpCompress.Test/ReaderTests.cs` (+68 -0) ➕ `tests/SharpCompress.Test/Tar/TarArchiveAsyncTests.cs` (+223 -0) ➕ `tests/SharpCompress.Test/Tar/TarReaderAsyncTests.cs` (+272 -0) ➕ `tests/SharpCompress.Test/Tar/TarWriterAsyncTests.cs` (+83 -0) 📝 `tests/SharpCompress.Test/WriterTests.cs` (+47 -0) </details> ### 📄 Description 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]](diffhunk://#diff-24d9933c6237700ff8ddf5307ee56793bc52e832fb97cf59fb093fbe49440d9fR23-R28) [[2]](diffhunk://#diff-d9ed0f511148da76d233d734091d18177d526bcb026ed5463061cde0c6d00c7cR146-R157) [[3]](diffhunk://#diff-4ab4fbb9acbd843bb76dcbb65a3e6d752eca4e6b630faa7ff533c5bb13048518R47-R64) * Implemented `SaveToAsync` overrides for `ZipArchive`, `TarArchive`, and `GZipArchive` to asynchronously write archive entries using their respective writers. [[1]](diffhunk://#diff-fdeace22df51f39be3461b03ffceb3ae6b63a006fa2f3428c3a4df6728354dc8R322-R339) [[2]](diffhunk://#diff-7f2eb9160ad6da95a3247f13cfb74c5556ae75ba12daaf9eeeab0edd8cd965d0R247-R270) [[3]](diffhunk://#diff-e39c32ff250a34b1b406d0cf4189b9f994b87ac4705576f32040829b4cf97870R211-R232) **Async entry extraction:** * Added `WriteToAsync`, `WriteToDirectoryAsync`, and `WriteToFileAsync` extension methods to `IArchiveEntryExtensions`, enabling asynchronous extraction of archive entries to streams, directories, or files. [[1]](diffhunk://#diff-61084e55d70b594ef97e944a0bc645b95f63a1854f75f17a038ab224850cfa0cR35-R62) [[2]](diffhunk://#diff-61084e55d70b594ef97e944a0bc645b95f63a1854f75f17a038ab224850cfa0cR78-R94) [[3]](diffhunk://#diff-61084e55d70b594ef97e944a0bc645b95f63a1854f75f17a038ab224850cfa0cR113-R132) **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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 22:20:22 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/sharpcompress#1395