diff --git a/src/Util.js b/src/Util.js index e304ebf..fc13229 100644 --- a/src/Util.js +++ b/src/Util.js @@ -34,13 +34,22 @@ class Util { }); } - static readdirRecursive(directory) { + /** + * Read directory recursively and return all file paths + * @static + * @param {string} directory Full path to target directory + * @param {boolean} [ignoreDotfiles=true] + * @return {string[]} Array with the paths to the files within the directory + * @memberof Util + */ + static readdirRecursive(directory, ignoreDotfiles = true) { const result = []; (function read(directory) { const files = fs.readdirSync(directory); for (const file of files) { + if (file.startsWith('.') && ignoreDotfiles) continue; const filePath = path.join(directory, file); if (fs.statSync(filePath).isDirectory()) {