MForster / factorio-rust-tools

A Rust library to export prototype definitions from Factorio.
4 stars 1 forks source link

Streaming download #74

Open MForster opened 1 year ago

MForster commented 1 year ago

ModPortalClient::download_mod currently returns a Result<Bytes>. We probably want a version that doesn't store the whole ZIP file in memory. Or maybe a version that goes straight to a file?

Builditluc commented 1 year ago

We could use the bytes_stream (EDIT: docs) function in the reqwest library to convert the response into a stream of bytes and then download each chunk directly into a newly generated file (the path of the file would be given to download_mod). I can create a PR if that sounds good

MForster commented 1 year ago

That would be great!