Created
May 31, 2022 16:40
-
-
Save jrcarl624/3d453322abbc0d1363e22f81cd7e2e21 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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