# `Mx.GitHub`
[🔗](https://github.com/mx-music/mx/blob/main/lib/mx/github.ex#L1)

Files of public GitHub repositories, downloaded into the user's cache, for samples a song names as `{:github, repo, ref, path}` and collections downloaded ahead of time.

Each repository and ref has its own folder in the cache, so two refs of one repository never share a file.
A file is written under a temporary name and renamed once complete, so an interrupted download never leaves a file that looks downloaded.
Files come from GitHub's raw file server, and a folder's files are listed with GitHub's API, which limits requests without a login.

# `dir`

The folder GitHub files are cached in: the `:github_dir` setting, or a folder in the user's cache.

# `fetch`

Downloads a file of a repository at a ref into the cache, and returns `:ok` or `{:error, reason}`.

# `list`

The paths of the files in a folder of a repository at a ref, or in the whole repository for nil, as `{:ok, paths}` or `{:error, message}`.

# `local`

Where a file of a repository at a ref is kept in the cache.

---

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