Recursively read a directory and return an array of all file paths
90
Build a file scanner utility that recursively scans a project directory and selectively includes files based on multiple filtering criteria.
Your scanner should implement filtering logic that:
node_modules directory at any depthbuild or dist directories at any depth.js, .json, .mdThe scanner should return an array of file paths relative to the scanned root directory.
.git, .env) excludes them @testnode_modules/package/file.js excludes it @testbuild/output.js excludes it @testdist/bundle.js excludes it @test.js, .json, and .md files, excluding .txt or .log files @test@generates
/**
* Recursively scans a directory and returns file paths that match the filtering criteria.
*
* @param {string} rootDir - The root directory to scan
* @returns {string[]} Array of relative file paths that match the criteria
*/
function scanProject(rootDir) {
// IMPLEMENTATION HERE
}
module.exports = { scanProject };Provides recursive directory reading with filtering capabilities.
@satisfied-by
Install with Tessl CLI
npx tessl i tessl/npm-fs-readdir-recursive