Zip a Ktor ByteChannel

Viewed 9

I need to consume some data¹ and stream it as part of a zip archive in a multipart request. I'm using a ByteChannel but I need something in the middle to zip the written data.
There's Java's ZipOutputStream, but that's not async/suspendable and I'm afraid getting an OutputStream from the channel and passing that to a zip stream will impact performance in a considerable way.

Is there any better method? If not, which measures can and should I take to minimize the impact of integrating a Java stream with a coroutine-based channel?

Thanks


¹ Potentially quite large, hence why I must stream it instead of getting it whole, zipping it and then pushing it elsewhere.

0 Answers
Related