Hristijan
02/21/2024, 8:17 AMHristijan
02/21/2024, 8:19 AMAleksei Tirman [JB]
02/21/2024, 10:16 AMval client = HttpClient(Android) {
install(ContentEncoding) {
gzip()
}
}
val outputStream = ByteArrayOutputStream() // For example
client.prepareGet("<https://httpbin.org/gzip>").execute { response ->
val inputStream = response.bodyAsChannel().toInputStream()
inputStream.use {
it.copyTo(outputStream)
}
// Clean up resources
outputStream.close()
}
Hristijan
02/21/2024, 11:33 AMHristijan
02/21/2024, 10:53 PMAleksei Tirman [JB]
02/22/2024, 7:37 AMContentEncoding
plugin is multiplatform. The only part of the code that needs rewriting is where the InputStream
and OutputStream
are used.Hristijan
02/22/2024, 11:59 AMContentEncoding
is multiplatform, my question was about gzip()
, sorryAleksei Tirman [JB]
02/22/2024, 12:01 PMgzip()
configuration method is multiplatform too.Hristijan
02/22/2024, 12:28 PMInputStream
and OutputStream
to KMP, sorry i’m new to this and i couldn’t find any documentation onlineAleksei Tirman [JB]
02/22/2024, 1:31 PMHristijan
02/22/2024, 1:31 PMAleksei Tirman [JB]
02/22/2024, 1:36 PMByteReadChannel
) to the target destination.