copyTo

suspend fun ByteReadChannel.copyTo(
    dst: ByteWriteChannel,
    limit: Long = Long.MAX_VALUE
): Long

Reads up to limit bytes from receiver channel and writes them to dst channel. Closes dst channel if fails to read or write with cause exception.

Return a number of copied bytes