Extensions for kotlinx.coroutines.io.ByteReadChannel

pass

suspend fun ByteReadChannel.pass(
    buffer: ByteBuffer,
    block: (ByteBuffer) -> Unit
): Unit
suspend fun ByteReadChannel.pass(
    buffer: ByteBuffer,
    block: suspend (ByteBuffer) -> Unit
): Unit

Read data chunks from ByteReadChannel using buffer

toByteArray

suspend fun ByteReadChannel.toByteArray(
    limit: Int = Int.MAX_VALUE
): ByteArray

Convert ByteReadChannel to ByteArray