# `Literature.DownloadHelpers`

Returns:

  * `{:ok, stored_file_absolute_path}` if everything were ok.
  * `{:error, :file_size_is_too_big}` if file size exceeds `max_file_size`
  * `{:error, :download_failure}` if host isn't reachable
  * `{:error, :eexist}` if file exists already

Options:

  * `max_file_size` - max available file size for downloading (in bytes). Default is `1024 * 1024 * 1000` (1GB)
  * `path` - absolute file path for the saved file. Default is `pwd <> requested file name`

## Examples

    iex> Literature.DownloadHelpers.download_image("http://speedtest.ftp.otenet.gr/files/test100k.db")
    {:ok, "/absolute/path/to/test_100k.db"}

    iex> Literature.DownloadHelpers.download_image("http://speedtest.ftp.otenet.gr/files/test100k.db", [max_file_size: 99 * 1000])
    {:error, :file_size_is_too_big}

    iex> Literature.DownloadHelpers.download_image("http://speedtest.ftp.otenet.gr/files/test100k.db", [path: "/custom/absolute/file/path.db"])
    {:ok, "/custom/absolute/file/path.db"}

# `download_image`

---

*Consult [api-reference.md](api-reference.md) for complete listing*
