All Projects → thecodrr → Fdir

thecodrr / Fdir

Licence: mit
⚡ The fastest directory crawler & globbing library for NodeJS. Crawls 1m files in < 1s

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Fdir

Fast Glob
🚀 It's a very fast and efficient glob library for Node.js
Stars: ✭ 1,150 (+48.01%)
Mutual labels:  fs, filesystem, glob
Draxt
draxt.js – NodeList/jQuery-like package for File System (node.js)
Stars: ✭ 192 (-75.29%)
Mutual labels:  fs, filesystem, glob
SimpleOS
Operating System Coded in Assembly and C
Stars: ✭ 72 (-90.73%)
Mutual labels:  filesystem, fs, os
Anymatch
‼️ Matches strings against configurable strings, globs, regular expressions, and/or functions
Stars: ✭ 289 (-62.81%)
Mutual labels:  fs, glob
replace-in-files
Replace text in one or more files or globs.
Stars: ✭ 21 (-97.3%)
Mutual labels:  filesystem, glob
mongoose-gridfs
mongoose gridfs on top of new gridfs api
Stars: ✭ 79 (-89.83%)
Mutual labels:  filesystem, fs
readdir
Recursively read a directory, blazing fast. Use with picomatch or micromatch to match globs.
Stars: ✭ 37 (-95.24%)
Mutual labels:  directory, fs
Chonky
😸 A File Browser component for React.
Stars: ✭ 313 (-59.72%)
Mutual labels:  fs, filesystem
Segyio
Fast Python library for SEGY files.
Stars: ✭ 291 (-62.55%)
Mutual labels:  hacktoberfest, fast
Personalsit.es
📇 A little directory of people's personal sites
Stars: ✭ 329 (-57.66%)
Mutual labels:  directory, hacktoberfest
Filer
Node-like file system for browsers
Stars: ✭ 389 (-49.94%)
Mutual labels:  fs, filesystem
delete-empty
Recursively delete all empty folders in a directory and child directories.
Stars: ✭ 38 (-95.11%)
Mutual labels:  directory, glob
fs.c
File system API much like Node's fs module (synchronous)
Stars: ✭ 65 (-91.63%)
Mutual labels:  filesystem, fs
Tfs
Mirror of https://gitlab.redox-os.org/redox-os/tfs
Stars: ✭ 2,890 (+271.94%)
Mutual labels:  fs, filesystem
findlargedir
find all "blackhole" directories with a huge amount of filesystem entries in a flat structure
Stars: ✭ 15 (-98.07%)
Mutual labels:  filesystem, os
Autocomplete.js
Simple autocomplete pure vanilla Javascript library.
Stars: ✭ 3,428 (+341.18%)
Mutual labels:  hacktoberfest, fast
Riot
RIOT - The friendly OS for IoT
Stars: ✭ 4,029 (+418.53%)
Mutual labels:  hacktoberfest, os
Cpx
A cli tool to watch and copy file globs.
Stars: ✭ 394 (-49.29%)
Mutual labels:  directory, glob
Tinydir
Lightweight, portable and easy to integrate C directory and file reader
Stars: ✭ 575 (-26%)
Mutual labels:  directory, filesystem
bash-glob
Bash-powered globbing for node.js. Alternative to node-glob. Does not work on Windows 9 and lower.
Stars: ✭ 13 (-98.33%)
Mutual labels:  fs, glob

The Fastest Directory Crawler & Globber for NodeJS

The Fastest: Nothing similar (in the NodeJS world) beats fdir in speed. It can easily crawl a directory containing 1 million files in < 1 second.

💡 Stupidly Easy: fdir uses expressive Builder pattern to build the crawler increasing code readability.

🤖 Zero Dependencies*: fdir only uses NodeJS fs & path modules.

🕺 Astonishingly Small: < 2KB in size gzipped & minified.

🔥 All Node Versions Supported: Unlike other similar libraries that have dropped support for Node versions < 10, fdir supports all versions >= 6.

🖮 Hackable: Extending fdir is extremely simple now that the new Builder API is here. Feel free to experiment around.

* picomatch must be installed manually by the user to support globbing.

Support

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

Status

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.

🚄 Quickstart

Installation

You can install using npm:

$ npm i fdir

or Yarn:

$ yarn add fdir

Usage

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.
});

Documentation:

I have written in-depth documentation here.

📊 Benchmarks:

Specs:

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

Notes:

  • Some people asked that I benchmark no-op (without options) version of fdir.
    • 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: **.js & **/**.js

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 lstat call (lstatSync) in the asynchronous API to acheive speed on Node < 10. This has been fixed in fdir 3.0.0.

Synchronous

🦮 LICENSE

Copyright © 2020 Abdullah Atta under MIT. Read full text here.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].