Open utterances-bot opened 1 year ago
You async example is actually doing a blocking file write and requires you to load the whole image into memory before writing it to a file.
A better way to do that would be to have reqwest give you a byte stream and write to the file with Tokio's async IO library as shown in this stack overflow answer: https://stackoverflow.com/a/74283625
This is great feedback! Thanks
Weekly Rust Trivia: How to Download an Image to a File · Thorsten Hans' blog
Weekly Rust Trivia 🦀: This week, we download an image from the web and store it in a file
https://www.thorsten-hans.com/weekly-rust-trivia-download-an-image-to-a-file/