Is your feature request related to a problem? Please describe.
I want to stream BZip2-compressed data from a result handler in an ASP.NET Core web app. The ASP.NET Core response stream only supports async operations. I found that BZip2OutputStream is inherently synchronous, so I copied it into my project and created BZip2AsyncOutputStream by means of straightforwardly replacing all calls to synchronously output bytes with async calls instead. A couple of cases required async-over-sync (explicit .Wait), since e.g. disposing the stream results in synchronous .Write and .Flush calls, but in the main operation it's all async. It seems to work. No idea on the impact on efficiency.
Would there be any interest in a contribution of this class?
Describe the solution you'd like
I'd like to make a PR that adds BZip2AsyncOutputStream to SharpZipLib so that other people who, like me, want to stream BZip2-compressed data in contexts that don't support synchronous I/O have an option. But I don't want to make a PR if it is unwelcome. :-)
Describe alternatives you've considered
There aren't really any alternatives, as I understand it. Async code simply requires you to be async up and down the call stack.
Is your feature request related to a problem? Please describe.
I want to stream BZip2-compressed data from a result handler in an ASP.NET Core web app. The ASP.NET Core response stream only supports async operations. I found that
BZip2OutputStream
is inherently synchronous, so I copied it into my project and createdBZip2AsyncOutputStream
by means of straightforwardly replacing all calls to synchronously output bytes with async calls instead. A couple of cases required async-over-sync (explicit.Wait
), since e.g. disposing the stream results in synchronous.Write
and.Flush
calls, but in the main operation it's all async. It seems to work. No idea on the impact on efficiency.Would there be any interest in a contribution of this class?
Describe the solution you'd like
I'd like to make a PR that adds
BZip2AsyncOutputStream
to SharpZipLib so that other people who, like me, want to stream BZip2-compressed data in contexts that don't support synchronous I/O have an option. But I don't want to make a PR if it is unwelcome. :-)Describe alternatives you've considered
There aren't really any alternatives, as I understand it. Async code simply requires you to be async up and down the call stack.
Tags
BZip2
Additional context
No response