seanmonstar / reqwest

An easy and powerful Rust HTTP Client
https://docs.rs/reqwest
Apache License 2.0
9.93k stars 1.12k forks source link

Add the ability to display progress of a request #222

Open jrmuizel opened 7 years ago

jrmuizel commented 7 years ago

i.e. if I'm downloading a large file it would be nice to get progress notifications. libcurl has:

int progress_callback(void *clientp,   double dltotal,   double dlnow,   double ultotal,   double ulnow);

CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROGRESSFUNCTION, progress_callback); 
seanmonstar commented 6 years ago

The interface to stream a response body requires one to call res.read(buf), so it shouldn't be too hard to know how many bytes have been read each time, right? Does this need to be a thing inside reqwest?

jrmuizel commented 6 years ago

No, that sounds like it might work. I'll take a look.