Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
const getFilePathList = (dir: string): string[] => {
return fs.readdirSync(dir, { withFileTypes: true }).flatMap((entry) => {
const path = `${dir}/${entry.name}`
return entry.isDirectory() ? getFilePathList(path) : path
})
}
const files = getFilePathList(targetPath)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment