fix build with old http-conduit
This commit is contained in:
parent
43b4e80bf5
commit
3c6e60dc69
1 changed files with 16 additions and 1 deletions
|
@ -326,10 +326,25 @@ download meterupdate url file uo = go `catchNonAsync` (const $ return False)
|
||||||
-
|
-
|
||||||
- Note that the responseStatus is not checked by this function.
|
- Note that the responseStatus is not checked by this function.
|
||||||
-}
|
-}
|
||||||
sinkResponseFile :: MonadResource m => MeterUpdate -> BytesProcessed -> FilePath -> IOMode -> Response (ConduitM () B8.ByteString m ()) -> m ()
|
sinkResponseFile
|
||||||
|
:: MonadResource m
|
||||||
|
=> MeterUpdate
|
||||||
|
-> BytesProcessed
|
||||||
|
-> FilePath
|
||||||
|
-> IOMode
|
||||||
|
#if MIN_VERSION_http_conduit(2,3,0)
|
||||||
|
-> Response (ConduitM () B8.ByteString m ())
|
||||||
|
#else
|
||||||
|
-> Response (ResumableSource m B8.ByteString)
|
||||||
|
#endif
|
||||||
|
-> m ()
|
||||||
sinkResponseFile meterupdate initialp file mode resp = do
|
sinkResponseFile meterupdate initialp file mode resp = do
|
||||||
(fr, fh) <- allocate (openBinaryFile file mode) hClose
|
(fr, fh) <- allocate (openBinaryFile file mode) hClose
|
||||||
|
#if MIN_VERSION_http_conduit(2,3,0)
|
||||||
runConduit $ responseBody resp .| go initialp fh
|
runConduit $ responseBody resp .| go initialp fh
|
||||||
|
#else
|
||||||
|
responseBody resp $$+- go initialp fh
|
||||||
|
#endif
|
||||||
release fr
|
release fr
|
||||||
where
|
where
|
||||||
go sofar fh = await >>= \case
|
go sofar fh = await >>= \case
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue