⚡ The fastest directory crawler & globbing library for NodeJS. Crawls 1m files in < 1s
⚡ The Fastest: Nothing similar (in the NodeJS world) beats
fdirin speed. It can easily crawl a directory containing 1 million files in < 1 second.
💡 Stupidly Easy:
fdiruses expressive Builder pattern to build the crawler increasing code readability.
🤖 Zero Dependencies*:
fdironly uses NodeJS
fs&
pathmodules.
🕺 Astonishingly Small: < 2KB in size gzipped & minified.
🔥 All Node Versions Supported: Unlike other similar libraries that have dropped support for Node versions < 10,
fdirsupports all versions >= 6.
🖮 Hackable: Extending
fdiris extremely simple now that the new Builder API is here. Feel free to experiment around.
*
picomatchmust 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.
This project is not dead. In terms of performance, I don't think there is anything more to be done. This is as fast a NodeJS Directory Crawler as you can get. I could be wrong though.
What's next: 1. There is still no Async Iterator API (contributions welcome). 2. We need to discuss whether its feasible (or even sensible) to have event emitters in different parts of the crawling process. 3. Make globbing pluggable 4. Finalize and freeze the API 5. Improve documentation (maybe we can make a proper documentation website?)
Contributions are welcome in all these.
You can install using
npm:
$ 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.
Specs:
Notes:
no-op(without options) version of
fdir.
sh $ sudo cpupower frequency-set --governor performance
Last updated: May 13, 2020 (fdir v3.3.0)
$ yarn bench:glob
glob pattern used:
**.js&**/**.js
| Synchronous | Asynchronous |
| :-------------------------------------------------------------------: | :--------------------------------------------------------------------: |
| |
|
Last updated: May 10, 2020 (fdir v3.0.0)
$ yarn bench
| Synchronous | Asynchronous |
| :---------------------------------------------------------------------: | :----------------------------------------------------------------------: |
| |
|
Older versions of fdir (1.x & 2.x) used synchronous
lstatcall (
lstatSync) 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.