# `HuggingfaceClient.Hub.Repositories.Snapshots`
[🔗](https://github.com/huggingface/huggingface_client/blob/v0.1.0/lib/huggingface_client/hub/repositories/snapshots.ex#L1)

Snapshot download — mirrors `snapshotDownload` from `@huggingface/hub`.

Downloads an entire repository at a specific revision to a local cache
directory using the same layout as the Python `huggingface_hub` library:

    ~/.cache/huggingface/hub/
      models--gpt2/
        refs/
          main          <- contains the commit SHA
        snapshots/
          abc123def.../
            config.json
            tokenizer.json
            ...

This makes snapshots compatible with tools that use the HuggingFace cache
directory convention.

# `default_cache_dir`

```elixir
@spec default_cache_dir() :: String.t()
```

Returns the default HF Hub cache directory.

# `download`

```elixir
@spec download(
  String.t(),
  keyword()
) :: {:ok, String.t()} | {:error, Exception.t()}
```

Downloads a full repository. See `HuggingfaceClient.snapshot_download/2`.

# `repo_folder_name`

```elixir
@spec repo_folder_name(String.t(), atom()) :: String.t()
```

Builds the local folder name for a repo, matching the Python library layout.

## Examples

    "models--gpt2"                             # model
    "datasets--rajpurkar--squad"              # dataset
    "spaces--gradio--hello_world"             # space

---

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