blob: 6e50dc540ae0a6fbf8cdded4df9d418a9c6cba75 [file]
import { RAW_GITHUB_URL, REPO_NAME } from './constants';
import { getError } from './utils';
export async function getRawFileFromGitHub(path: string) {
const res = await fetch(RAW_GITHUB_URL + path);
if (res.ok) return res.text();
throw await getError('GitHub raw download error', res);
}
export function getRawFileFromRepo(path: string, tag: string) {
return getRawFileFromGitHub(`/${REPO_NAME}/${tag}${path}`);
}
export function getRawAssetFromRepo(path: string, tag: string) {
return `${RAW_GITHUB_URL}/${REPO_NAME}/${tag}${path}`;
}