Skip to content
Search

Readdirp

lastmod 2026-01-05created 2026-01-052 edits

A Node.js reader for efficiently reading large directories

About

  • A tool designed to recursively read entire nested directories, addressing the limitations of fs.readdir-based approaches
  • Designed around a Stream API, keeping RAM and CPU usage low even on large file trees
    • Supports both the for-await pattern and event-based streams
  • Also provides a Promise API when needed, but with higher memory and CPU usage than the stream approach
  • Provides fileFilter / directoryFilter for fine-grained control over files and directories
    • Can include only specific extensions or exclude directories such as .git
  • The depth option can limit the recursion depth
  • Returns Dirent-based information by default to optimize performance, and provides fs.Stats information via the alwaysStat option when needed
    • Recommended to enable only when file size, mtime, etc. are needed
  • Provides options suited to real-world environments, such as symbolic link handling and file type control
  • When used with chokidar, well suited to building workflows that clearly separate file traversal from change detection

See also

Favorite site

author Zer0 sitemap