Skip to content

Instantly share code, notes, and snippets.

@jrcarl624
Created May 31, 2022 16:40
Show Gist options
  • Save jrcarl624/3d453322abbc0d1363e22f81cd7e2e21 to your computer and use it in GitHub Desktop.
Save jrcarl624/3d453322abbc0d1363e22f81cd7e2e21 to your computer and use it in GitHub Desktop.
const listFiles = (
dir: fs.PathLike,
files?: path.ParsedPath[] | undefined
): path.ParsedPath[] => {
files = files || [];
var funcList = fs.readdirSync(dir);
for (var i in funcList) {
var name = dir + "/" + funcList[i];
if (fs.statSync(name).isDirectory()) {
listFiles(name, files);
} else {
files.push(path.parse(name));
}
}
return files;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment