Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rrdir

Package Overview
Dependencies
Maintainers
1
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rrdir - npm Package Compare versions

Comparing version 11.0.1 to 12.0.0

32

index.js
import {readdir, stat, lstat} from "node:fs/promises";
import {readdirSync, statSync, lstatSync} from "node:fs";
import {sep} from "node:path";
import picomatch from "picomatch";

@@ -33,29 +34,10 @@ const sepBuffer = Buffer.from(sep);

export function pathGlobToRegex(glob, {flags = undefined} = {flags: undefined}) {
return new RegExp(`${glob
.replace(/[|\\{}()[\]^$+.-]/g, "\\$&")
.replace(/\*\*\/\*/, ".*")
.replace(/\*\*/g, ".*")
.replace(/\//g, "[/\\\\]")
.replace(/([^.])\*/g, (_, p1) => `${p1}[^/\\\\]*`)
.replaceAll("**", "*")
.replaceAll("?", ".")
}$`, flags);
}
function makeMatcher(filters, flags) {
const regexes = filters.map(filter => pathGlobToRegex(filter, {flags}));
return str => {
for (const regex of regexes) {
if (regex.test(str)) return true;
}
return false;
function makeMatchers({include, exclude, insensitive}) {
const opts = {
dot: true,
flags: insensitive ? "i" : undefined,
};
}
function makeMatchers({include, exclude, insensitive}) {
const flags = insensitive ? "i" : "";
return {
includeMatcher: include ? makeMatcher(include, flags) : null,
excludeMatcher: exclude ? makeMatcher(exclude, flags) : null,
includeMatcher: include ? picomatch(include, opts) : null,
excludeMatcher: exclude ? picomatch(exclude, opts) : null,
};

@@ -62,0 +44,0 @@ }

{
"name": "rrdir",
"version": "11.0.1",
"version": "12.0.0",
"description": "Recursive directory reader with a delightful API",

@@ -12,3 +12,3 @@ "author": "silverwind <me@silverwind.io>",

"engines": {
"node": ">=16"
"node": ">=18"
},

@@ -19,7 +19,8 @@ "files": [

"devDependencies": {
"eslint": "8.39.0",
"eslint-config-silverwind": "67.0.1",
"updates": "14.1.0",
"versions": "11.0.0",
"vitest": "0.30.1"
"eslint": "8.47.0",
"eslint-config-silverwind": "74.1.2",
"updates": "14.3.5",
"versions": "11.0.2",
"vitest": "0.34.2",
"vitest-config-silverwind": "3.0.0"
},

@@ -36,3 +37,6 @@ "keywords": [

"scandir"
]
],
"dependencies": {
"picomatch": "2.3.1"
}
}
# rrdir
[![](https://img.shields.io/npm/v/rrdir.svg?style=flat)](https://www.npmjs.org/package/rrdir) [![](https://img.shields.io/npm/dm/rrdir.svg)](https://www.npmjs.org/package/rrdir) [![](https://img.shields.io/bundlephobia/minzip/rrdir.svg)](https://bundlephobia.com/package/rrdir)
[![](https://img.shields.io/npm/v/rrdir.svg?style=flat)](https://www.npmjs.org/package/rrdir) [![](https://img.shields.io/npm/dm/rrdir.svg)](https://www.npmjs.org/package/rrdir) [![](https://packagephobia.com/badge?p=rrdir)](https://packagephobia.com/result?p=rrdir)
> Recursive directory reader with a delightful API
`rrdir` recursively reads a directory and returns entries within via an async iterator or async/sync as Array. It has zero dependencies and can typically iterate millions of files in a matter of seconds. Memory usage is `O(1)` for the async iterator and `O(n)` for the Array variants.
`rrdir` recursively reads a directory and returns entries within via an async iterator or async/sync as Array. It can typically iterate millions of files in a matter of seconds. Memory usage is `O(1)` for the async iterator and `O(n)` for the Array variants.

@@ -8,0 +8,0 @@ ## Usage

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