Skip to content

feature request: full async/await pattern stream support #223

Open

Description

@coelacanth16

Expected behavior

I could not find any related topics, except an unanswered issue "CopyToAsync fails with ZipOutputStream #167".

One of c#'s greatest features over other languages is the async/await pattern. The .net streams all support async/await since ver 4.5 and there could be major implications and performance enhancers for FileStream in particular. Is there any plan to implement this support in this library?

Activity

  1. added
    enhancement
    on May 12, 2018
  2. Numpsy commented on Apr 5, 2020

    @Numpsy
    Contributor

    So, I had a little bit of a look at this (partly as it's requested, partly out of thinking it might be interesting to tinker with). I initially wondered if it would be possible to start at the bottom of the stream and add it a bit at a time, but the way the zip/gzip streams are imple,ented as subclasses of the deflator streams rather than as containers causes issues with that (if you only implement the async methds of the base class, async calls on the subclasses go through to those and miss the archive specific pieces).
    So, bit more of an all-in change there.

    However, as a starter - I adapted a few on the unit tests to use async stream calls as a test, and those changes could be made independantly of library changes (as it stands and async calls will be forwarded to the sync versions by the base stream class, but it async methods were to be implemented later that would mean there was already a test base for them).

    @piksel and comments and/or objections to the idea of adding some async tests to the existing zip test suite? (would just be variants of the existing tests but with async stream calls to start with)

  3. piksel commented on Apr 7, 2020

    @piksel
    Member

    No, I guess that would be fine.

  4. self-assigned this
    on Nov 22, 2020
  5. linked a pull request that will close this issueAdd support for Filename field in GZip #351on Nov 22, 2020
  6. linked a pull request that will close this issueSet and Get a file name internal gzip #366on Nov 22, 2020
  7. removed their assignment
    on Nov 22, 2020
  8. added a commit that references this issue on Dec 7, 2020
    ba3b30f
  9. mark-at-tusksoft commented on May 6, 2021

    @mark-at-tusksoft

    Running into the same issue as reported in a similar library
    haf/DotNetZip.Semverd#60

     Uncaught (in promise) Error: System.NotSupportedException: Synchronous reads are not supported.
       at Microsoft.AspNetCore.Components.Forms.BrowserFileStream.Read(Byte[] buffer, Int32 offset, Int32 count)
       at ICSharpCode.SharpZipLib.Zip.Compression.Streams.InflaterInputBuffer.Fill()
       at ICSharpCode.SharpZipLib.Zip.Compression.Streams.InflaterInputBuffer.ReadLeByte()
       at ICSharpCode.SharpZipLib.Zip.Compression.Streams.InflaterInputBuffer.ReadLeShort()
       at ICSharpCode.SharpZipLib.Zip.Compression.Streams.InflaterInputBuffer.ReadLeInt()
       at ICSharpCode.SharpZipLib.Zip.ZipInputStream.GetNextEntry()
    
  10. Numpsy commented on May 6, 2021

    @Numpsy
    Contributor

    It's being worked on a bit at a time, but there's quite a bit of work to change everywhere.

  11. linked a pull request that will close this issuefeat(zip): ZipOutputStream async support #574on May 8, 2021
  12. Numpsy commented on Oct 9, 2021

    @Numpsy
    Contributor

    Do we want to close this, or leave it in case of adding async support to the other stream classes (Bzip2 etc) ?

  13. piksel commented on Oct 9, 2021

    @piksel
    Member

    They should probably be their own issues, although much of the work done in #574 can be used to implement them in the other streams as well. full async/await pattern stream is kind of vague as a issue scope. I will leave it open for now...

  14. reopened this on Oct 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions