I’m working to download some large files… this lead me into working with streams. This post and the related article were helpful:
The basic pattern is:
url
|> HTTPDownload.stream!()
|> Stream.into(File.stream!("save.file"))
|> Stream.run()
Most files download fine, but the specific problematic file is a Walmart site map: https://www.walmart.com/sitemap_store_dept1.xml.gz
– this isn’t a large file. I don’t know if the host is doing something to prevent programmatic download, but the download just hangs (whereas using a browser works no problem).
This all lead me to the http_stream
package, but I’m experiencing errors using it (see bug: Example fails to download · Issue #7 · subvisual/http_stream · GitHub). I think everything works so long as I can provide some additional headers, including a timeout, but I can’t seem to find a client that offers streaming AND supports custom headers and options.
Can anyone explain how or why the request hangs? Or if there’s some other client that can stream files with options?