Safe Haskell | None |
---|---|
Language | Haskell2010 |
- verifiedDownload :: (MonadUnliftIO m, MonadLogger m, HasRunner env, MonadReader env m) => DownloadRequest -> Path Abs File -> (Maybe Integer -> Sink ByteString IO ()) -> m Bool
- recoveringHttp :: (MonadUnliftIO m, MonadLogger m, HasRunner env, MonadReader env m) => RetryPolicy -> m a -> m a
- data DownloadRequest = DownloadRequest {}
- drRetryPolicyDefault :: RetryPolicy
- data HashCheck = (Show a, HashAlgorithm a) => HashCheck {}
- data CheckHexDigest
- type LengthCheck = Int
- data VerifiedDownloadException
Documentation
:: (MonadUnliftIO m, MonadLogger m, HasRunner env, MonadReader env m) | |
=> DownloadRequest | |
-> Path Abs File | destination |
-> (Maybe Integer -> Sink ByteString IO ()) | custom hook to observe progress |
-> m Bool | Whether a download was performed |
Copied and extended version of Network.HTTP.Download.download.
Has the following additional features: * Verifies that response content-length header (if present) matches expected length * Limits the download to (close to) the expected # of bytes * Verifies that the expected # bytes were downloaded (not too few) * Verifies md5 if response includes content-md5 header * Verifies the expected hashes
Throws VerifiedDownloadException. Throws IOExceptions related to file system operations. Throws HttpException.
recoveringHttp :: (MonadUnliftIO m, MonadLogger m, HasRunner env, MonadReader env m) => RetryPolicy -> m a -> m a Source #
data DownloadRequest Source #
A request together with some checks to perform.
drRetryPolicyDefault :: RetryPolicy Source #
Default to retrying thrice with a short constant delay.
(Show a, HashAlgorithm a) => HashCheck | |
data CheckHexDigest Source #
type LengthCheck = Int Source #
data VerifiedDownloadException Source #
An exception regarding verification of a download.