import { readdir } from "fs/promises";
import fs from "fs";
import path from "path";

const getFilesFromBinaries = async (webAppDir: string) => {
    const returnFiles: { file: string; mtime: Date }[] = [];
    const dir = await readdir(webAppDir);

    dir.forEach((file) => {
        const statSync = fs.statSync(path.join(webAppDir, file));
        returnFiles.push({ file, mtime: statSync.mtime });
        return;
    });

    return returnFiles;
};

export default getFilesFromBinaries;
