ktor-io / io.ktor.utils.io.jvm.javaio / java.io.InputStream / copyTo

copyTo

suspend fun InputStream.copyTo(channel: ByteWriteChannel, limit: Long = Long.MAX_VALUE): Long

Copies up to limit bytes from this input stream to CIO byte channel blocking on reading this stream and suspending on channel if required

Return
number of bytes copied