zipFile

fun Flow<ByteArray>.zipFile(entryName: String, dispatcher: CoroutineDispatcher = Dispatchers.IO): Flow<ByteArray>

Compresses the given Flow of ByteArrays into a ZIP file containing a single entry with the provided entryName.

Return

A Flow of ByteArrays representing the compressed ZIP content.

Example usage:

val byteArrayFlow: Flow<ByteArray> = ...
val zippedFlow = byteArrayFlow.zipFile("example.txt")
zippedFlow.collect { bytes -> ... }

Parameters

entryName

The name of the ZIP entry.

dispatcher

The coroutine dispatcher to be used. Defaults to Dispatchers.IO.