Copyright | (c) Julian Ospald 2020 |
---|---|
License | LGPL-3.0 |
Maintainer | hasufell@hasufell.de |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
Module for handling all download related functions.
Generally we support downloading via:
- curl (default)
- wget
- internal downloader (only when compiled)
Synopsis
- getDownloadsF :: (FromJSONKey Tool, FromJSONKey Version, FromJSON VersionInfo, MonadIO m, MonadCatch m, MonadLogger m, MonadThrow m, MonadFail m, MonadReader AppState m) => URLSource -> Excepts '[JSONError, DownloadFailed, FileDoesNotExistError] m GHCupInfo
- readFromCache :: (MonadIO m, MonadCatch m, MonadLogger m, MonadReader AppState m) => Excepts '[JSONError, FileDoesNotExistError] m GHCupInfo
- getBase :: (MonadFail m, MonadIO m, MonadCatch m, MonadLogger m, MonadReader AppState m) => Excepts '[JSONError, FileDoesNotExistError] m GHCupInfo
- getDownloadInfo :: Tool -> Version -> PlatformRequest -> GHCupDownloads -> Either NoDownload DownloadInfo
- download :: (MonadMask m, MonadReader AppState m, MonadThrow m, MonadLogger m, MonadIO m) => DownloadInfo -> Path Abs -> Maybe (Path Rel) -> Excepts '[DigestError, DownloadFailed] m (Path Abs)
- downloadCached :: (MonadMask m, MonadResource m, MonadThrow m, MonadLogger m, MonadIO m, MonadReader AppState m) => DownloadInfo -> Maybe (Path Rel) -> Excepts '[DigestError, DownloadFailed] m (Path Abs)
- downloadBS :: (MonadReader AppState m, MonadCatch m, MonadIO m, MonadLogger m) => URI -> Excepts '[FileDoesNotExistError, HTTPStatusError, URIParseError, UnsupportedScheme, NoLocationHeader, TooManyRedirs, ProcessError] m ByteString
- checkDigest :: (MonadIO m, MonadThrow m, MonadLogger m, MonadReader AppState m) => DownloadInfo -> Path Abs -> Excepts '[DigestError] m ()
- getCurlOpts :: IO [ByteString]
- getWgetOpts :: IO [ByteString]
Documentation
getDownloadsF :: (FromJSONKey Tool, FromJSONKey Version, FromJSON VersionInfo, MonadIO m, MonadCatch m, MonadLogger m, MonadThrow m, MonadFail m, MonadReader AppState m) => URLSource -> Excepts '[JSONError, DownloadFailed, FileDoesNotExistError] m GHCupInfo Source #
Downloads the download information! But only if we need to ;P
readFromCache :: (MonadIO m, MonadCatch m, MonadLogger m, MonadReader AppState m) => Excepts '[JSONError, FileDoesNotExistError] m GHCupInfo Source #
getBase :: (MonadFail m, MonadIO m, MonadCatch m, MonadLogger m, MonadReader AppState m) => Excepts '[JSONError, FileDoesNotExistError] m GHCupInfo Source #
:: Tool | |
-> Version | tool version |
-> PlatformRequest | |
-> GHCupDownloads | |
-> Either NoDownload DownloadInfo |
:: (MonadMask m, MonadReader AppState m, MonadThrow m, MonadLogger m, MonadIO m) | |
=> DownloadInfo | |
-> Path Abs | destination dir |
-> Maybe (Path Rel) | optional filename |
-> Excepts '[DigestError, DownloadFailed] m (Path Abs) |
Tries to download from the given http or https url and saves the result in continuous memory into a file. If the filename is not provided, then we: 1. try to guess the filename from the url path 2. otherwise create a random file
The file must not exist.
:: (MonadMask m, MonadResource m, MonadThrow m, MonadLogger m, MonadIO m, MonadReader AppState m) | |
=> DownloadInfo | |
-> Maybe (Path Rel) | optional filename |
-> Excepts '[DigestError, DownloadFailed] m (Path Abs) |
Download into tmpdir or use cached version, if it exists. If filename is omitted, infers the filename from the url.
downloadBS :: (MonadReader AppState m, MonadCatch m, MonadIO m, MonadLogger m) => URI -> Excepts '[FileDoesNotExistError, HTTPStatusError, URIParseError, UnsupportedScheme, NoLocationHeader, TooManyRedirs, ProcessError] m ByteString Source #
This is used for downloading the JSON.
checkDigest :: (MonadIO m, MonadThrow m, MonadLogger m, MonadReader AppState m) => DownloadInfo -> Path Abs -> Excepts '[DigestError] m () Source #
getCurlOpts :: IO [ByteString] Source #
Get additional curl args from env. This is an undocumented option.
getWgetOpts :: IO [ByteString] Source #
Get additional wget args from env. This is an undocumented option.