# `ExGram.File`
[🔗](https://github.com/rockneurotiko/ex_gram/blob/0.65.0/lib/ex_gram/file.ex#L1)

Helpers for working with Telegram file downloads.

After retrieving file metadata with `ExGram.get_file/2`, use `file_url/2` to
generate the download URL for the file.

# `file`

```elixir
@type file() ::
  String.t()
  | {:file, String.t()}
  | {:file_content, iodata() | File.Stream.t(), String.t()}
```

# `file_url`

```elixir
@spec file_url(
  ExGram.Model.File.t(),
  keyword()
) :: String.t()
```

Generate the full file URL ready to be downloaded.

## Usage

First, retrieve the file metadata:

    {:ok, file} = ExGram.get_file(file_id)

Then generate the download URL:

    ExGram.File.file_url(file)

You can pass the usual `:bot` and `:token` params:

    ExGram.File.file_url(file, bot: :my_bot)
    ExGram.File.file_url(file, token: "MyBotToken")

---

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