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

rrdir

Package Overview
Dependencies
Maintainers
0
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 13.1.2 to 13.2.0

dist/index.d.ts.map

11

dist/index.d.ts
import { Stats } from 'node:fs';
import { Matcher } from 'picomatch';
type Encoding = "utf8" | "buffer";
type Dir = string | Uint8Array;
type RRDirOpts = {
export type Encoding = "utf8" | "buffer";
export type Dir = string | Uint8Array;
export type DirNodeCompatible = string | Buffer;
export type RRDirOpts = {
strict?: boolean;

@@ -19,3 +19,3 @@ stats?: boolean;

};
type Entry = {
export type Entry = {
/** The path to the entry, will be relative if `dir` is given relative. If `dir` is a `Uint8Array`, this will be too. Always present. */

@@ -36,1 +36,2 @@ path: Dir;

export {};
//# sourceMappingURL=index.d.ts.map

@@ -48,4 +48,3 @@ import { readdir, stat, lstat } from "node:fs/promises";

({ includeMatcher, excludeMatcher } = makeMatchers(opts));
if (typeof dir === "string" && /[/\\]$/.test(dir))
dir = dir.substring(0, dir.length - 1);
if (typeof dir === "string" && /[/\\]$/.test(dir)) dir = dir.substring(0, dir.length - 1);
encoding = getEncoding(dir);

@@ -57,12 +56,9 @@ }

} catch (err) {
if (opts.strict)
throw err;
if (opts.strict) throw err;
yield { path: dir, err };
}
if (!dirents.length)
return;
if (!dirents.length) return;
for (const dirent of dirents) {
const path = makePath(dirent, dir, encoding);
if (excludeMatcher?.(encoding === "buffer" ? toString(path) : path))
continue;
if (excludeMatcher?.(encoding === "buffer" ? toString(path) : path)) continue;
const isSymbolicLink = opts.followSymlinks && dirent.isSymbolicLink();

@@ -77,4 +73,3 @@ const encodedPath = encoding === "buffer" ? toString(path) : path;

} catch (err) {
if (opts.strict)
throw err;
if (opts.strict) throw err;
yield { path, err };

@@ -87,14 +82,11 @@ }

if (isSymbolicLink) {
if (!stats)
try {
stats = await stat(path);
} catch {
}
if (stats && stats.isDirectory())
recurse = true;
if (!stats) try {
stats = await stat(path);
} catch {
}
if (stats && stats.isDirectory()) recurse = true;
} else if (dirent.isDirectory()) {
recurse = true;
}
if (recurse)
yield* rrdir(path, opts, { includeMatcher, excludeMatcher, encoding });
if (recurse) yield* rrdir(path, opts, { includeMatcher, excludeMatcher, encoding });
}

@@ -106,4 +98,3 @@ }

({ includeMatcher, excludeMatcher } = makeMatchers(opts));
if (typeof dir === "string" && /[/\\]$/.test(dir))
dir = dir.substring(0, dir.length - 1);
if (typeof dir === "string" && /[/\\]$/.test(dir)) dir = dir.substring(0, dir.length - 1);
encoding = getEncoding(dir);

@@ -116,12 +107,9 @@ }

} catch (err) {
if (opts.strict)
throw err;
if (opts.strict) throw err;
results.push({ path: dir, err });
}
if (!dirents.length)
return results;
if (!dirents.length) return results;
await Promise.all(dirents.map(async (dirent) => {
const path = makePath(dirent, dir, encoding);
if (excludeMatcher?.(encoding === "buffer" ? toString(path) : path))
return;
if (excludeMatcher?.(encoding === "buffer" ? toString(path) : path)) return;
const isSymbolicLink = opts.followSymlinks && dirent.isSymbolicLink();

@@ -136,4 +124,3 @@ const encodedPath = encoding === "buffer" ? toString(path) : path;

} catch (err) {
if (opts.strict)
throw err;
if (opts.strict) throw err;
results.push({ path, err });

@@ -146,14 +133,11 @@ }

if (isSymbolicLink) {
if (!stats)
try {
stats = await stat(path);
} catch {
}
if (stats && stats.isDirectory())
recurse = true;
if (!stats) try {
stats = await stat(path);
} catch {
}
if (stats && stats.isDirectory()) recurse = true;
} else if (dirent.isDirectory()) {
recurse = true;
}
if (recurse)
results.push(...await rrdirAsync(path, opts, { includeMatcher, excludeMatcher, encoding }));
if (recurse) results.push(...await rrdirAsync(path, opts, { includeMatcher, excludeMatcher, encoding }));
}));

@@ -166,4 +150,3 @@ return results;

({ includeMatcher, excludeMatcher } = makeMatchers(opts));
if (typeof dir === "string" && /[/\\]$/.test(dir))
dir = dir.substring(0, dir.length - 1);
if (typeof dir === "string" && /[/\\]$/.test(dir)) dir = dir.substring(0, dir.length - 1);
encoding = getEncoding(dir);

@@ -176,12 +159,9 @@ }

} catch (err) {
if (opts.strict)
throw err;
if (opts.strict) throw err;
results.push({ path: dir, err });
}
if (!dirents.length)
return results;
if (!dirents.length) return results;
for (const dirent of dirents) {
const path = makePath(dirent, dir, encoding);
if (excludeMatcher?.(encoding === "buffer" ? toString(path) : path))
continue;
if (excludeMatcher?.(encoding === "buffer" ? toString(path) : path)) continue;
const isSymbolicLink = opts.followSymlinks && dirent.isSymbolicLink();

@@ -196,4 +176,3 @@ const encodedPath = encoding === "buffer" ? toString(path) : path;

} catch (err) {
if (opts.strict)
throw err;
if (opts.strict) throw err;
results.push({ path, err });

@@ -206,14 +185,11 @@ }

if (isSymbolicLink) {
if (!stats)
try {
stats = statSync(path);
} catch {
}
if (stats && stats.isDirectory())
recurse = true;
if (!stats) try {
stats = statSync(path);
} catch {
}
if (stats && stats.isDirectory()) recurse = true;
} else if (dirent.isDirectory()) {
recurse = true;
}
if (recurse)
results.push(...rrdirSync(path, opts, { includeMatcher, excludeMatcher, encoding }));
if (recurse) results.push(...rrdirSync(path, opts, { includeMatcher, excludeMatcher, encoding }));
}

@@ -220,0 +196,0 @@ return results;

{
"name": "rrdir",
"version": "13.1.2",
"version": "13.2.0",
"description": "Recursive directory reader with a delightful API",

@@ -23,15 +23,15 @@ "author": "silverwind <me@silverwind.io>",

"devDependencies": {
"@types/node": "20.12.12",
"@types/picomatch": "2.3.3",
"@types/node": "22.10.1",
"@types/picomatch": "3.0.1",
"eslint": "8.57.0",
"eslint-config-silverwind": "83.0.1",
"eslint-config-silverwind-typescript": "3.2.5",
"typescript-config-silverwind": "4.2.0",
"updates": "16.0.1",
"versions": "12.0.1",
"vite": "5.2.11",
"vite-config-silverwind": "2.1.0",
"vitest": "1.5.0",
"vitest-config-silverwind": "8.0.4"
"eslint-config-silverwind": "94.2.1",
"eslint-config-silverwind-typescript": "9.2.0",
"typescript-config-silverwind": "6.1.1",
"updates": "16.4.0",
"versions": "12.1.2",
"vite": "6.0.1",
"vite-config-silverwind": "3.1.0",
"vitest": "2.1.6",
"vitest-config-silverwind": "9.2.0"
}
}
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