Socket
Socket
Sign inDemoInstall

fdir

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fdir - npm Package Compare versions

Comparing version 5.3.0 to 6.0.0

dist/benchmarks/benchmark.d.ts

39

package.json
{
"name": "fdir",
"version": "5.3.0",
"version": "6.0.0",
"description": "The fastest directory crawler & globbing alternative to glob, fast-glob, & tiny-glob. Crawls 1m files in < 1s",
"main": "index.js",
"main": "dist/index.js",
"scripts": {
"test": "jest __tests__/fdir.test.js",
"test:coverage": "jest __tests__/fdir.test.js --coverage",
"prepublishOnly": "npm run test && npm run build",
"build": "tsc",
"test": "tap --ts --no-check-coverage __tests__/",
"test:coverage": "tap --ts --no-check-coverage --coverage-report=html __tests__/",
"bench": "node benchmarks/benchmark.js",

@@ -43,4 +45,10 @@ "bench:glob": "node benchmarks/glob-benchmark.js",

"devDependencies": {
"@types/glob": "^8.0.1",
"@types/mock-fs": "^4.13.1",
"@types/node": "^18.13.0",
"@types/picomatch": "^2.3.0",
"@types/tap": "^15.0.8",
"all-files-in-tree": "^1.1.2",
"benny": "^3.6.14",
"benny": "^3.7.1",
"expect": "^29.4.2",
"fast-glob": "^3.2.2",

@@ -53,15 +61,18 @@ "fdir1": "npm:fdir@1.2.0",

"fs-readdir-recursive": "^1.1.0",
"get-all-files": "^2.0.0",
"glob": "^7.1.6",
"get-all-files": "^4.1.0",
"glob": "^8.1.0",
"klaw-sync": "^6.0.0",
"mock-fs": "^5.0.0",
"picomatch": "^2.2.2",
"mock-fs": "^5.2.0",
"picomatch": "^2.3.1",
"recur-readdir": "0.0.1",
"recursive-files": "^1.0.2",
"recursive-fs": "^2.0.0",
"recursive-readdir": "^2.2.2",
"rrdir": "^6.1.2",
"systeminformation": "^5.3.1",
"recursive-fs": "^2.1.0",
"recursive-readdir": "^2.2.3",
"rrdir": "^10.1.1",
"systeminformation": "^5.17.8",
"tap": "^16.3.4",
"tiny-glob": "^0.2.9",
"walk-sync": "^2.0.2"
"ts-node": "^10.9.1",
"typescript": "^4.9.5",
"walk-sync": "^3.0.0"
},

@@ -68,0 +79,0 @@ "peerDependencies": {

@@ -25,4 +25,2 @@ <p align="center">

🔥 **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.

@@ -36,15 +34,2 @@

## 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

@@ -68,4 +53,4 @@

```js
const { fdir } = require("fdir");
```ts
import { fdir } from "fdir";

@@ -86,68 +71,26 @@ // create the builder

I have written [in-depth documentation here](https://github.com/thecodrr/fdir/blob/master/documentation.md).
Documentation for all methods is available [here](/documentation.md).
## 📊 Benchmarks:
**Specs:**
Please check the benchmark against the latest version [here](/BENCHMARKS.md).
- CPU: Intel i7 7th Generation (7700HQ)
- RAM: 16 GB
- Storage: 256 GB SSD
- OS: Manjaro Linux
- Directory Size: < 2k files
## 🙏Used by:
**Notes:**
`fdir` is downloaded over 100k+ times a week by projects around the world. Here's a list of some notable projects using `fdir` in production:
- 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
```sh
$ sudo cpupower frequency-set --governor performance
```
- Run the benchmark
> Note: if you think your project should be here, feel free to open an issue. Notable is anything with a considerable amount of GitHub stars.
### The Fastest Globber
1. [mdn/yari](https://github.com/mdn/yari)
2. [streetwriters/notesnook](https://github.com/streetwriters/notesnook)
3. [zhangdaren/miniprogram-to-uniapp](https://github.com/zhangdaren/miniprogram-to-uniapp)
4. [imba/imba](https://github.com/imba/imba)
5. [napi-rs/napi-rs](https://github.com/napi-rs/napi-rs)
6. [moroshko/react-scanner](https://github.com/moroshko/react-scanner)
7. [FredKSchott/snowpack](https://github.com/FredKSchott/snowpack)\*
_Last updated: May 13, 2020 (fdir v3.3.0)_
- `snowpack` has since been discontinued.
```sh
$ yarn bench:glob
```
> glob pattern used: `**.js` & `**/**.js`
#### Node v13.13.0
| Synchronous | Asynchronous |
| :-------------------------------------------------------------------: | :--------------------------------------------------------------------: |
| ![](https://github.com/thecodrr/fdir/raw/master/assets/glob-sync.png) | ![](https://github.com/thecodrr/fdir/raw/master/assets/glob-async.png) |
### The Fastest Directory Crawler
_Last updated: May 10, 2020 (fdir v3.0.0)_
```sh
$ yarn bench
```
#### Node v14.2.0:
| Synchronous | Asynchronous |
| :---------------------------------------------------------------------: | :----------------------------------------------------------------------: |
| ![](https://github.com/thecodrr/fdir/raw/master/assets/node13-sync.png) | ![](https://github.com/thecodrr/fdir/raw/master/assets/node13-async.png) |
#### 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 | |
| :--------------------------------------------------------------------: | :---------------------------------------------------------------------: |
| ![](https://github.com/thecodrr/fdir/raw/master/assets/node8-sync.png) | ![](https://github.com/thecodrr/fdir/raw/master/assets/node8-async.png) |
## 🦮 LICENSE
Copyright &copy; 2020 Abdullah Atta under MIT. [Read full text here.](https://github.com/thecodrr/fdir/raw/master/LICENSE)
Copyright &copy; 2023 Abdullah Atta under MIT. [Read full text here.](https://github.com/thecodrr/fdir/raw/master/LICENSE)

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc