Recursively read a directory and return an array of all file paths
90
Build a directory analysis utility that safely scans directories and handles various edge cases gracefully, returning consistent results even when directories don't exist or are empty.
The utility should scan directories and return file lists without throwing errors when encountering problematic paths.
The utility should recursively traverse directories to find all files.
@generates
/**
* Scans a directory path and returns all file paths found.
* Handles non-existent directories gracefully by returning an empty array.
*
* @param {string} dirPath - The directory path to scan
* @returns {string[]} Array of relative file paths found, or empty array if directory doesn't exist
*/
function scanDirectory(dirPath) {
// IMPLEMENTATION HERE
}
module.exports = { scanDirectory };Provides recursive directory reading with built-in edge case handling.
Install with Tessl CLI
npx tessl i tessl/npm-fs-readdir-recursive