This commit is contained in:
nirholas
2026-03-31 10:26:23 +00:00
parent d55e4a852e
commit 8ba939ba68
58 changed files with 982 additions and 26 deletions

View File

@@ -23,28 +23,6 @@ main().catch((err) => {
process.exit(1);
});
} catch {
return false;
}
}
async function fileExists(p: string): Promise<boolean> {
try {
return (await fs.stat(p)).isFile();
} catch {
return false;
}
}
/** List immediate children of a directory (files & dirs). */
async function listDir(dir: string): Promise<string[]> {
try {
const entries = await fs.readdir(dir, { withFileTypes: true });
return entries.map((e: { isDirectory(): boolean; name: string }) => (e.isDirectory() ? e.name + "/" : e.name)).sort();
} catch {
return [];
}
}
/** Recursively collect all file paths under `root` (relative to root). */
async function walkFiles(root: string, rel = ""): Promise<string[]> {