Safe Haskell | None |
---|---|
Language | Haskell2010 |
A library for listing "files" in an http "directory".
import Network.HTTP.Directory import qualified Data.Text as T main = do files <- httpDirectory "https://example.com/some/dir/" mapM_ T.putStrLn files httpFileSize (head files) >>= print
Synopsis
- httpDirectory :: Manager -> String -> IO [Text]
- httpFileSize :: Manager -> String -> IO (Maybe Integer)
- httpRedirect :: Manager -> String -> IO (Maybe ByteString)
- httpRedirects :: Manager -> String -> IO [ByteString]
Documentation
httpDirectory :: Manager -> String -> IO [Text] Source #
List the file links (hrefs) in an http directory
Note if the directory (webpage) url is redirected you may need to use
httpRedirect
to determine the actual final url prefix for relative links
(files).
httpFileSize :: Manager -> String -> IO (Maybe Integer) Source #
Try to get the filesize (Content-Length) of an http file
httpRedirect :: Manager -> String -> IO (Maybe ByteString) Source #
Return final redirect for an url
httpRedirects :: Manager -> String -> IO [ByteString] Source #
Returns the list of http redirects for an url in reverse order (ie last redirect is first)