CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-fs-readdir-recursive

Recursively read a directory and return an array of all file paths

90

1.11x
Overview
Eval results
Files

task.mdevals/scenario-6/

Project File Scanner

Build a file scanner utility that recursively scans a project directory and selectively includes files based on multiple filtering criteria.

Requirements

Your scanner should implement filtering logic that:

  1. Excludes all hidden files and directories (those starting with '.')
  2. Excludes all files in any node_modules directory at any depth
  3. Excludes all files in any build or dist directories at any depth
  4. Only includes files with specific extensions: .js, .json, .md

The scanner should return an array of file paths relative to the scanned root directory.

Test Cases

  • Scanning a directory with hidden files (.git, .env) excludes them @test
  • Scanning a directory containing node_modules/package/file.js excludes it @test
  • Scanning a directory containing build/output.js excludes it @test
  • Scanning a directory containing dist/bundle.js excludes it @test
  • Scanning returns only .js, .json, and .md files, excluding .txt or .log files @test
  • Scanning an empty directory returns an empty array @test

@generates

API

/**
 * 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 };

Dependencies { .dependencies }

fs-readdir-recursive { .dependency }

Provides recursive directory reading with filtering capabilities.

@satisfied-by

Install with Tessl CLI

npx tessl i tessl/npm-fs-readdir-recursive

tile.json