Skip to content

Instantly share code, notes, and snippets.

@Bargs
Last active July 15, 2016 15:41
Show Gist options
  • Select an option

  • Save Bargs/e9bd1a41d5d1e0aea912e30248db0675 to your computer and use it in GitHub Desktop.

Select an option

Save Bargs/e9bd1a41d5d1e0aea912e30248db0675 to your computer and use it in GitHub Desktop.
function getFilesRecursivelyFromTopDir(topDir, translationFiles, languageList) {
return readdir(topDir)
.then((topDirectoryListing) => {
return Promise.map(topDirectoryListing, (listing) => {
const fullPath = path.join(topDir, listing);
return stat(fullPath).then((stats) => {
if (stats.isDirectory()) {
console.log('** FullPath **: ' + fullPath + ' is a directory');
getTranslationDetailsFromDirectory(fullPath, translationFiles, languageList);
} else {
console.log('** FullPath **: ' + fullPath + ' is a file');
getTranslationDetailsFromFile(fullPath, translationFiles, languageList);
}
})
})
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment