Alex Styl
02/15/2025, 7:31 AMorg.w3c.files.File
into an Input
so that I can upload in a multiform ktor client request?Skaldebane
02/15/2025, 9:58 PMFileReader
to read its contents into a ByteArray
.Aleksei Tirman [JB]
02/17/2025, 8:55 AMorg.w3c.files.File
to Input
because the request body cannot be streamed in a browser. You can read the file into Uint8Array
and then convert it to a ByteArray
with the following code:
fun Uint8Array.asByteArray(): ByteArray {
return Int8Array(buffer, byteOffset, length).asDynamic()
}
Alex Styl
02/17/2025, 3:52 PM