nxxm / xxhr

intuitive c++ http client library
https://nxxm.github.io/xxhr
Other
28 stars 8 forks source link

Feature/download streams #16

Closed pysco68 closed 1 year ago

pysco68 commented 2 years ago

Downloading huge files to memory is kind-of expensive and was blocking me the other day on a memory-constrained env.

This PR adds a DownloadTo argument which can be used as in:

  GET( "https://nxxm.indigenious.io/distro/all/clang/v13.0.0/clang-13-windows-64bit.zip"s, 
    DownloadTo("test.out.zip", 
           [](auto &resp, auto &out_path, size_t file_size) { /** .... download completed ... */ },  
           [](size_t dltotal, size_t dlnow) { /**  ...download progress... */ }
    )
  );

⚠️ currently only implemented on-top the CPR/curl backend branch. The Boost::BEAST backend def. requires more work as we would have to port the Proxy support as well at the same time

daminetreg commented 1 year ago

This has been made part of #17 , closing as approved.