Created
June 23, 2020 16:15
-
-
Save robwozniak/3d266902ac7efe9d7d03f3caa22ee4db 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 fs = require('fs') | |
const path = require('path') | |
const getAllFiles = dir => fs.readdirSync(dir).reduce((files, file) => { | |
const name = path.join(dir, file) | |
const isDirectory = fs.statSync(name).isDirectory() | |
return isDirectory ? [...files, ...getAllFiles(name)] : [...files, name] | |
}, []) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment