You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
504 B

2 months ago
import { join } from "path";
import fs from "fs/promises";
export async function getFilesInDir(path) {
const dir = await fs.opendir(path);
const results = [];
for await (const file of dir){
let resolvedFile = file;
if (file.isSymbolicLink()) {
resolvedFile = await fs.stat(join(path, file.name));
}
if (resolvedFile.isFile()) {
results.push(file.name);
}
}
return results;
}
//# sourceMappingURL=get-files-in-dir.js.map