download-curl-0.1.4: High-level file download based on URLs

Portability | posix
Stability | provisional
Maintainer | Don Stewart <dons@galois.com>
Safe Haskell | None

Network.Curl.Download

Contents

- The basic interface to network content
- Parsers for common formats
- A lower level interface

Description

A binding to curl, an efficient, high level library for retrieving files using Uniform Resource Locators (URLs).

Content may be retrieved as a strings, ByteString or parsed as HTML tags, XML or RSS and Atom feeds.

Error handling is encapsulated in the Either type.

Synopsis

- openURI :: String -> IO (Either String ByteString)
- openURIString :: String -> IO (Either String String)
- openAsTags :: String -> IO (Either String [Tag String])
- openAsXML :: String -> IO (Either String [Content])
- openAsFeed :: String -> IO (Either String Feed)
- openURIWithOpts :: [CurlOption] -> String -> IO (Either String ByteString)

# The basic interface to network content

openURI :: String -> IO (Either String ByteString)Source

Download content specified by a url using curl, returning the content as a strict ByteString.

If an error occurs, Left is returned, with a protocol-specific error string.

Examples:

     openURI "http://haskell.org"

openURIString :: String -> IO (Either String String)Source

Like openURI, but returns the result as a `String`

Examples:

     openURIString "http://haskell.org"

# Parsers for common formats

openAsTags :: String -> IO (Either String [Tag String])Source

Download the content as for openURI, but return it as a list of parsed tags using the tagsoup html parser.

openAsXML :: String -> IO (Either String [Content])Source

Download the content as for openURI, but return it as parsed XML, using the xml-light parser.

openAsFeed :: String -> IO (Either String Feed)Source

Download the content as for openURI, but return it as parsed RSS or Atom content, using the feed library parser.

# A lower level interface

openURIWithOpts :: [CurlOption] -> String -> IO (Either String ByteString)Source

Like openURI, but takes curl options.

Examples:

     openURIWithOpts [CurlPost True] "http://haskell.org"