HTTPStream (HTTPStream v1.0.0) View Source

Main API interface.

HTTPStream is a tiny tiny library for streaming big big files. It works by wrapping HTTP requests onto a Stream. You can use it with Flow, write it to disk through regular streams and more!

HTTPStream.get(large_image_url)
|> Stream.into(File.stream!("large_image.png"))
|> Stream.run()

The adapter can be configured by setting in your config/config.exs:

config :http_stream, adapter: HTTPStream.Adapter.Mint

At the moment, only two adapters are supported: Mint (default) and HTTPoison.

Link to this section Summary

Functions

Performs a DELETE request.

Performs a GET request.

Performs a HEAD request.

Performs a OPTIONS request.

Performs a PATCH request.

Performs a POST request.

Performs a PUT request.

Performs a TRACE request.

Link to this section Types

Specs

method() :: String.t()

Link to this section Functions

Specs

delete(String.t(), keyword()) :: Enumerable.t()

Performs a DELETE request.

Supported options:

  • :headers (optional) - Keyword list of HTTP headers to add to the request.
  • :query (optional) - Keyword list of query params to add to the request.

Specs

get(String.t(), keyword()) :: Enumerable.t()

Performs a GET request.

Supported options:

  • :headers (optional) - Keyword list of HTTP headers to add to the request.
  • :query (optional) - Keyword list of query params to add to the request.

Specs

head(String.t(), keyword()) :: Enumerable.t()

Performs a HEAD request.

Supported options:

  • :headers (optional) - Keyword list of HTTP headers to add to the request.
  • :query (optional) - Keyword list of query params to add to the request.
Link to this function

options(url, opts \\ [])

View Source

Specs

options(String.t(), keyword()) :: Enumerable.t()

Performs a OPTIONS request.

Supported options:

  • :headers (optional) - Keyword list of HTTP headers to add to the request.
  • :query (optional) - Keyword list of query params to add to the request.

Specs

patch(String.t(), keyword()) :: Enumerable.t()

Performs a PATCH request.

Supported options:

  • :headers (optional) - Keyword list of HTTP headers to add to the request.
  • :params (optional) - Keyword list of query params to add to the request.

Specs

post(String.t(), keyword()) :: Enumerable.t()

Performs a POST request.

Supported options:

  • :headers (optional) - Keyword list of HTTP headers to add to the request.
  • :params (optional) - Keyword list of query params to add to the request.

Specs

put(String.t(), keyword()) :: Enumerable.t()

Performs a PUT request.

Supported options:

  • :headers (optional) - Keyword list of HTTP headers to add to the request.
  • :params (optional) - Keyword list of query params to add to the request.
Link to this function

request(method, url, headers \\ [], body \\ "")

View Source

Specs

request(method(), String.t(), keyword(), binary()) :: Enumerable.t()

Performs an HTTP request.

Supported methods: GET, OPTIONS, HEAD, TRACE, POST, PUT, PATCH and DELETE

Specs

trace(String.t(), keyword()) :: Enumerable.t()

Performs a TRACE request.

Supported options:

  • :headers (optional) - Keyword list of HTTP headers to add to the request.
  • :query (optional) - Keyword list of query params to add to the request.