https://kotlinlang.org logo
p

pgreze

02/04/2021, 6:51 AM
Hi @kittinunf , I need your help about an
OutOfMemoryError: Java heap space
I’m facing. I’m trying to download a file and write its content in a file like that:
Copy code
val result = location.httpGet().response()
destination.writeBytes(result.third.get())
Is there some built-in helper in order to help avoiding memory issues? thx in advance 🙏
At the end this section samples https://github.com/kittinunf/fuel/blob/master/fuel/README.md#download-response-to-output-file-or-outputstream and end up with this code:
Copy code
val response = location.httpDownload()
            .fileDestination { _, _ -> destination }
            .response()
check(response.second.statusCode == 200) { "Invalid download: $response" }
k

kittinunf

02/04/2021, 7:38 AM
Does it work?
p

pgreze

02/04/2021, 7:54 AM
like a charm 👍 as long as I’m not requesting the response.data explicitly, it’s working fine
k

kittinunf

02/04/2021, 8:43 AM
kk, are you downloading movie or something? lol
p

pgreze

02/09/2021, 6:22 AM
Sadly nothing as fun as movies 😆
8 Views