Guest User

Untitled

a guest
Jul 18th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. function getFilesInDirSync(pathToDir, files = []) {
  2. const dirContents = fs.readdirSync(pathToDir);
  3. return files.concat(dirContents.map(item => {
  4. const isDir = fs.statSync(pathToDir + item).isDirectory()
  5. return isDir ? getFilesInDirSync(`${pathToDir}/{item}`, files) : [`${pathToDir}/{item}`]
  6. }))
  7. })
Add Comment
Please, Sign In to add comment