Drivers
GitHub
Map files from a remote github repository (readonly).
Usage
This driver fetches all possible keys once and keep it in cache for 10 minutes. Due to GitHub rate limit, it is highly recommended to provide a token. It only applies to fetching keys.
import { createStorage } from "unstorage";
import githubDriver from "unstorage/drivers/github";
const storage = createStorage({
driver: githubDriver({
repo: "nuxt/nuxt",
branch: "main",
dir: "/docs",
}),
});
Options:
repo
: Github repository. Format isusername/repo
ororg/repo
(required)token
: Github API token. (recommended)branch
: Target branch. Default ismain
dir
: Use a directory as driver root.ttl
: Filenames cache revalidate time. Default is600
seconds (10 minutes)apiURL
: Github API domain. Default ishttps://api.github.com
cdnURL
: Github RAW CDN Url. Default ishttps://raw.githubusercontent.com