Downloading large files from the Internet in Haskell

前端 未结 1 1049
陌清茗
陌清茗 2021-02-09 20:42

Are there any suggestions about how to download large files in Haskell? I figure Http.Conduit is is the library is a good library for this. However, how does it solve this? Ther

相关标签:
1条回答
  • Network.HTTP.Conduit provides three functions for performing a request:

    • simpleHttp
    • httpLbs
    • http

    Out of the three functions, the first two functions will make the entire response body to live in memory. If you want to operate in constant memory, then use http function. The http function gives you access to a streaming interface through ResumableSource

    The example you have provided in your code uses interleaved IO to write the response body to a file in constant memory space. So, you will not run out of memory when downloading a large file.

    0 讨论(0)
提交回复
热议问题