-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | http directory listing library -- -- Library for listing the files (links) in an http directory. Also can -- check the size and modtime of files, and for url redirects. @package http-directory @version 0.1.2 -- | A library for listing "files" in an http "directory". -- --
-- import Network.HTTP.Directory -- import qualified Data.Text as T -- import Network.HTTP.Client (newManager) -- import Network.HTTP.Client.TLS (tlsManagerSettings) -- -- main = do -- mgr <- newManager tlsManagerSettings -- files <- httpDirectory mgr "https://example.com/some/dir/" -- mapM_ T.putStrLn files -- httpFileSize mgr (head files) >>= print -- httpLastModified mgr (head files) >>= print --module Network.HTTP.Directory -- | List the file links (hrefs) in an http directory -- -- Raises an error if the http request fails. -- -- Note if the directory (webpage) url is redirected to a different path -- you may need to use httpRedirect to determine the actual final -- url prefix for relative links (files). httpDirectory :: Manager -> String -> IO [Text] -- | Try to get the filesize (Content-Length field) of an http file -- -- Raises an error if the http request fails. httpFileSize :: Manager -> String -> IO (Maybe Integer) -- | Try to get the modification time (Last-Modified field) of an http file -- -- Raises an error if the http request fails. httpLastModified :: Manager -> String -> IO (Maybe UTCTime) -- | alias for 'newManager tlsManagerSettings' so one does not need to -- import http-client etc httpManager :: IO Manager -- | Return final redirect for an url httpRedirect :: Manager -> String -> IO (Maybe ByteString) -- | Returns the list of http redirects for an url in reverse order (ie -- last redirect is listed first) httpRedirects :: Manager -> String -> IO [ByteString]