ktor-io / io.ktor.utils.io.core / readBytesOf

readBytesOf

fun Input.readBytesOf(min: Int = 0, max: Int = Int.MAX_VALUE): ByteArray

Reads at least min but no more than max bytes from the input to a new byte array

Exceptions

EOFException - if not enough bytes available to get min bytes