``` httpClient.put<ByteArray>(realUrl...
# ktor
i
Copy code
httpClient.put<ByteArray>(realUrl){
            body = "aha".toByteArray()
        }
this code can upload data to a link, now I need to get upload progress, how to use a outputStream to instead of this way to upload data?
Copy code
val _outputStream = httpClient.put<HttpResponse>(realUrl)
        val outputStream = _outputStream.receive<OutputStream>()

        outputStream.write("abc".toByteArray())
        outputStream.flush()
        outputStream.close()
this won't work, error message o.ktor.client.call.NoTransformationFoundException: No transformation found: class io.ktor.utils.io.ByteBufferChannel (Kotlin reflection is not available) -> class java.io.OutputStream (Kotlin reflection is not available)
g
you cannot receive OutputStream
you can use ByteWriteChannel
See sample here (it for download, but it’s the same idea): https://ktor.io/docs/streaming.html
i
Copy code
val aa = httpClient.put<HttpResponse>(realUrl)
    val ab = aa.receive<ByteWriteChannel>()
    ab.write("abc")
    ab.flush()
    
    val ac = httpClient.put<ByteWriteChannel>(realUrl)
    ac.write("abc")
    ac.flush()
like this? there're no much info on that doc