Parsed documentation:
View on GitHub
Sends the given file or binary as a download.

The second argument must be `{:binary, contents}`, where
`contents` will be sent as download, or`{:file, path}`,
where `path` is the filesystem location of the file to
be sent. Be careful to not interpolate the path from
external parameters, as it could allow traversal of the

The download is achieved by setting "content-disposition"
to attachment. The "content-type" will also be set based
on the extension of the given filename but can be customized
via the `:content_type` and `:charset` options.

## Options

  * `:filename` - the filename to be presented to the user
    as download
  * `:content_type` - the content type of the file or binary
    sent as download. It is automatically inferred from the
    filename extension
  * `:disposition` - specifies dispositon type
    (`:attachment` or `:inline`). If `:attachment` was used,
    user will be prompted to save the file. If `:inline` was used,
    the browser will attempt to open the file.
    Defaults to `:attachment`.
  * `:charset` - the charset of the file, such as "utf-8".
    Defaults to none
  * `:offset` - the bytes to offset when reading. Defaults to `0`
  * `:length` - the total bytes to read. Defaults to `:all`
  * `:encode` - encodes the filename using `URI.encode_www_form/1`.
    Defaults to `true`. When `false`, disables encoding. If you
    disable encoding, you need to guarantee there are no special
    characters in the filename, such as quotes, newlines, etc.
    Otherwise you can expose your application to security attacks

## Examples

To send a file that is stored inside your application priv

    path = Application.app_dir(:my_app, "priv/prospectus.pdf")
    send_download(conn, {:file, path})

When using `{:file, path}`, the filename is inferred from the
given path but may also be set explicitly.

To allow the user to download contents that are in memory as
a binary or string:

    send_download(conn, {:binary, "world"}, filename: "hello.txt")

See `Plug.Conn.send_file/3` and `Plug.Conn.send_resp/3` if you
would like to access the low-level functions used to send files
and responses via Plug.
Please help! Open an issue on GitHub if this assessment is incorrect.