ktor-io / io.ktor.utils.io / readPacket

readPacket

suspend fun ByteReadChannel.readPacket(size: Int): ByteReadPacket

Reads the specified amount of bytes and makes a byte packet from them. Fails if channel has been closed and not enough bytes available.