icsharpcode / SharpZipLib

#ziplib is a Zip, GZip, Tar and BZip2 library written entirely in C# for the .NET platform.
http://icsharpcode.github.io/SharpZipLib/
MIT License
3.73k stars 976 forks source link

fix(zip): fully implement async deflate #813

Closed piksel closed 1 year ago

piksel commented 1 year ago

Using the previously implemented parts of async deflate/ZipOutputStream would only work as long as the compressed size was lower than the internal deflater buffer. This fix adds async writing to DeflaterOutputStream and GzipOutputStream, and allows ZipOutputStream to empty it's buffer using asynchronous writes.

This also extends the test for ZipOutputStream to try with a larger source buffer and adds a test for GzipOutputStream for wholly-async IO.

Additionally, GzipOutputStream.ModifiedTime can now also be set. This was added to allow the tests to yield a predicable output.

I certify that I own, and have sufficient rights to contribute, all source code and related material intended to be compiled or integrated with the source code for the SharpZipLib open source product (the "Contribution"). My Contribution is licensed under the MIT License.

codecov[bot] commented 1 year ago

Codecov Report

Merging #813 (20944e4) into master (58b5c4e) will increase coverage by 0.00%. The diff coverage is 85.36%.

@@           Coverage Diff           @@
##           master     #813   +/-   ##
=======================================
  Coverage   74.77%   74.78%           
=======================================
  Files          72       72           
  Lines        8501     8535   +34     
=======================================
+ Hits         6357     6383   +26     
- Misses       2144     2152    +8     
Impacted Files Coverage Δ
...rc/ICSharpCode.SharpZipLib/GZip/GzipInputStream.cs 71.13% <0.00%> (ø)
src/ICSharpCode.SharpZipLib/Tar/TarBuffer.cs 72.72% <ø> (-0.90%) :arrow_down:
src/ICSharpCode.SharpZipLib/Tar/TarHeader.cs 84.53% <ø> (+0.05%) :arrow_up:
src/ICSharpCode.SharpZipLib/Tar/TarInputStream.cs 62.32% <ø> (-0.89%) :arrow_down:
...c/ICSharpCode.SharpZipLib/GZip/GzipOutputStream.cs 86.66% <76.47%> (+0.18%) :arrow_up:
src/ICSharpCode.SharpZipLib/Zip/ZipOutputStream.cs 88.38% <90.90%> (-0.20%) :arrow_down:
...ib/Zip/Compression/Streams/DeflaterOutputStream.cs 83.89% <100.00%> (+1.17%) :arrow_up:
... and 1 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.