create project

This commit is contained in:
ismailsosic
2022-12-27 12:05:56 +01:00
parent 2a33a2d3de
commit cd2143287c
16035 changed files with 2489703 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
import { join } from "path";
import { nonNullable } from "./non-nullable";
import { promises } from "fs";
export async function flatReaddir(dir, include) {
const dirents = await promises.readdir(dir, {
withFileTypes: true
});
const result = await Promise.all(dirents.map(async (part)=>{
const absolutePath = join(dir, part.name);
if (part.isSymbolicLink()) {
const stats = await promises.stat(absolutePath);
if (stats.isDirectory()) {
return null;
}
}
if (part.isDirectory() || !include.test(part.name)) {
return null;
}
return absolutePath;
}));
return result.filter(nonNullable);
}
//# sourceMappingURL=flat-readdir.js.map