Wow, thanks to Felipe's and Michael's quick response. Haskell community is so kind.
I will try your suggestions right now!
Here's an example of printing the total number of bytes consumed using http-conduit:import Control.Monad.IO.Class (liftIO)import qualified Data.ByteString as Simport Data.Conduitimport Data.Conduit.Binary as CBimport Network.HTTP.Conduitmain :: IO ()main = withManager $ \manager -> doreq <- parseUrl "http://www.yesodweb.com/"res <- http req managerresponseBody res $$+- printProgress =$ CB.sinkFile "yesodweb.html"printProgress :: Conduit S.ByteString (ResourceT IO) S.ByteStringprintProgress =loop 0whereloop len = await >>= maybe (return ()) (\bs -> dolet len' = len + S.length bsliftIO $ putStrLn $ "Bytes consumed: " ++ show len'yield bsloop len')HTH,MichaelOn Mon, Dec 10, 2012 at 3:34 PM, Cedric Fung <root@vec.io> wrote:
Hi,
Are there any suggestions to download a large file with Haskell? I have read the docs for Network, Network.HTTP and Network.HTTP.Conduit, but can't find anything which fit my requirements.
I want to download a large file from an HTTP URL, and show the progress instantly. Maybe some functions which read HTTP connection and return a lazy ByteString could do this work?
Though I found a low-level socket lazy package, which seems to work, I just want a more high level API.
Thanks and regards.
_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://www.haskell.org/mailman/listinfo/beginners