Files
pihka-al/server/api/files/index.get.ts
Pihkaal 27cb044247
All checks were successful
Deploy / build (push) Successful in 12m22s
Deploy / deploy (push) Successful in 1s
feat: use portainer hook instead of pushing image to gitea package repository
2026-05-30 23:25:50 +02:00

21 lines
537 B
TypeScript

import { readdir, stat } from "node:fs/promises";
import { resolve } from "node:path";
const filesDir = () => resolve(process.cwd(), "public/files");
export default defineEventHandler(async () => {
const dir = filesDir();
try {
const names = await readdir(dir);
const files = await Promise.all(
names.map(async (name) => {
const s = await stat(resolve(dir, name));
return { name, size: s.size, modifiedAt: s.mtime.toISOString() };
}),
);
return files;
} catch {
return [];
}
});