by thecodrr

thecodrr /fdir

โšก The fastest directory crawler & globbing library for NodeJS. Crawls 1m files in < 1s

724 Stars 23 Forks Last release: about 2 months ago (v4.1.0) MIT License 178 Commits 17 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:

The Fastest Directory Crawler & Globber for NodeJS

โšก The Fastest: Nothing similar (in the NodeJS world) beats

in speed. It can easily crawl a directory containing 1 million files in < 1 second.

๐Ÿ’ก Stupidly Easy:

uses expressive Builder pattern to build the crawler increasing code readability.

๐Ÿค– Zero Dependencies*:

only uses NodeJS

๐Ÿ•บ Astonishingly Small: < 2KB in size gzipped & minified.

๐Ÿ”ฅ All Node Versions Supported: Unlike other similar libraries that have dropped support for Node versions < 10,

supports all versions >= 6.

๐Ÿ–ฎ Hackable: Extending

is extremely simple now that the new Builder API is here. Feel free to experiment around.


must be installed manually by the user to support globbing.


Do you like this project? Support me by donating, creating an issue, becoming a stargazer, or opening a pull request. Thanks.

๐Ÿš„ Quickstart


You can install using

$ npm i fdir

or Yarn:

$ yarn add fdir


const { fdir } = require("fdir");

// create the builder const api = new fdir().withFullPaths().crawl("path/to/dir");

// get all files in a directory synchronously const files = api.sync();

// or asynchronously api.withPromise().then((files) => { // do something with the result here. });


I have written in-depth documentation here.

๐Ÿ“Š Benchmarks:


  • CPU: Intel i7 7th Generation (7700HQ)
  • RAM: 16 GB
  • Storage: 256 GB SSD
  • OS: Manjaro Linux
  • Directory Size: < 2k files


  • Some people asked that I benchmark
    (without options) version of
    • I did and found no performance difference. The results were identical. (I didn't include it here as it wasn't anything special.)
  • Some other people were doubtful about the authenticity of these results due to frequency scaling, process overload, disk warmup, etc.
    • So I have updated the benchmark with new results that should resolve all those doubts. Here's the process I followed:
    • Hard shutdown the laptop (a couple of times just to be sure) to clear disk, ram cache etc.
    • Login directly to a TTY (avoiding any unnecessary process from starting).
    • Disable CPU Scaling using
      $ sudo cpupower frequency-set --governor performance
    • Run the benchmark

The Fastest Globber

Last updated: May 13, 2020 (fdir v3.3.0)

$ yarn bench:glob

glob pattern used:


Node v13.13.0

| Synchronous | Asynchronous | | :-------------------------------------------------------------------: | :--------------------------------------------------------------------: | | | |

The Fastest Directory Crawler

Last updated: May 10, 2020 (fdir v3.0.0)

$ yarn bench

Node v14.2.0:

| Synchronous | Asynchronous | | :---------------------------------------------------------------------: | :----------------------------------------------------------------------: | | | |

Node v8.7.0:

Older versions of fdir (1.x & 2.x) used synchronous

call (
) in the asynchronous API to acheive speed on Node < 10. This has been fixed in fdir 3.0.0.

| Synchronous | | | :--------------------------------------------------------------------: | :---------------------------------------------------------------------: | | | |


Copyright ยฉ 2020 Abdullah Atta under MIT. Read full text here.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.