-
|
I am creating a ktor app running on Netty to process images and other large files. I want to grab the first 1-4KB of the input to determine the content type and then use the How do you think I can effectively merge the first part of the image I grabbed with the remaining, unread channel? Something like this: val header = ByteArray(1024)
content.readAvailable(header, length = header.size) // content is the ByteReadChannel exposed from the multipart provider()
val mimeType = deriveValidMimeType(header.copyOf())
ByteReadChannel(header) + contentThe goal here is to not have to buffer the entire file into heap. Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
Hi @dmaiken, there is a |
Beta Was this translation helpful? Give feedback.
Hi @dmaiken, there is a
ByteReadChannel.peek(Int): ByteStringextension function for this kind of scenario.