renombrar a cacheDir

This commit is contained in:
Cat /dev/Nulo 2023-07-17 19:05:54 -03:00
parent 1f410fc847
commit 879a5f1433

View file

@ -10,7 +10,7 @@ type RegistrySecret = string;
const getToken = memoizeDownloader(_getToken); const getToken = memoizeDownloader(_getToken);
let squashfsDownloads = new Map<string, Promise<string>>(); let squashfsDownloads = new Map<string, Promise<string>>();
const tmpDir = "cache/"; const cacheDir = "cache/";
// { // {
// const image = "gitea.nulo.in/nulo/zulip-checkin-cyborg"; // const image = "gitea.nulo.in/nulo/zulip-checkin-cyborg";
// const tag = "latest"; // const tag = "latest";
@ -27,7 +27,7 @@ export function parseImageRef(ref: string): { image: string; tag: string } {
} }
export async function downloadImage(image: string, tag: string) { export async function downloadImage(image: string, tag: string) {
await mkdir(tmpDir, { recursive: true }); await mkdir(cacheDir, { recursive: true });
const manifest = await getManifest(image, tag); const manifest = await getManifest(image, tag);
// sanity check // sanity check
@ -75,7 +75,7 @@ async function saveSquashfs(
let p = squashfsDownloads.get(key); let p = squashfsDownloads.get(key);
if (!p) { if (!p) {
p = (async () => { p = (async () => {
const output = join(tmpDir, key); const output = join(cacheDir, key);
try { try {
await access(output); await access(output);
// ya está cacheado // ya está cacheado