I would like to download a big file using Ktor cli...
# ktor
o
I would like to download a big file using Ktor client and save it. I don’t know how to use
ByteReadChannel
. Is there an example code which writes contents to a file from
ByteReadChannel
? https://ktor.io/clients/http-client/calls/responses.html#HttpResponse
g
it shows how to write to temporary file, but you can easily modify it to use permanent file
o
Thanks!
call.response.content.copyAndClose(file.writeChannel())
This one line is really helpful to me.