Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

BZip2AsyncOutputStream #877

Open
logiclrd opened this issue Sep 8, 2024 · 0 comments
Open

BZip2AsyncOutputStream #877

logiclrd opened this issue Sep 8, 2024 · 0 comments
Labels
bzip2 enhancement Feature request or other improvements of existing functionality

Comments

@logiclrd
Copy link

logiclrd commented Sep 8, 2024

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.

Tags

BZip2

Additional context

No response

@logiclrd logiclrd added the enhancement Feature request or other improvements of existing functionality label Sep 8, 2024
@github-actions github-actions bot added the bzip2 label Sep 8, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bzip2 enhancement Feature request or other improvements of existing functionality
Projects
None yet
Development

No branches or pull requests

1 participant