Comparing version 10.0.1 to 10.0.2
30
index.js
@@ -59,11 +59,7 @@ import {readdir, stat, lstat} from "fs/promises"; | ||
let dirents = []; | ||
try { | ||
dirents = await readdir(dir, {encoding, withFileTypes: true}); | ||
} catch (err) { | ||
if (opts.strict) { | ||
throw err; | ||
} else { | ||
yield {path: dir, err}; | ||
} | ||
if (opts.strict) throw err; | ||
yield {path: dir, err}; | ||
} | ||
@@ -74,3 +70,3 @@ if (!dirents.length) return; | ||
const path = makePath(dirent, dir, encoding); | ||
if (excludeMatcher && excludeMatcher(encoding === "buffer" ? String(path) : path)) continue; | ||
if (excludeMatcher?.(encoding === "buffer" ? String(path) : path)) continue; | ||
@@ -116,11 +112,7 @@ const isSymbolicLink = opts.followSymlinks && dirent.isSymbolicLink(); | ||
let dirents = []; | ||
try { | ||
dirents = await readdir(dir, {encoding, withFileTypes: true}); | ||
} catch (err) { | ||
if (opts.strict) { | ||
throw err; | ||
} else { | ||
results.push({path: dir, err}); | ||
} | ||
if (opts.strict) throw err; | ||
results.push({path: dir, err}); | ||
} | ||
@@ -131,3 +123,3 @@ if (!dirents.length) return results; | ||
const path = makePath(dirent, dir, encoding); | ||
if (excludeMatcher && excludeMatcher(encoding === "buffer" ? String(path) : path)) return; | ||
if (excludeMatcher?.(encoding === "buffer" ? String(path) : path)) return; | ||
@@ -175,11 +167,7 @@ const isSymbolicLink = opts.followSymlinks && dirent.isSymbolicLink(); | ||
let dirents = []; | ||
try { | ||
dirents = readdirSync(dir, {encoding, withFileTypes: true}); | ||
} catch (err) { | ||
if (opts.strict) { | ||
throw err; | ||
} else { | ||
results.push({path: dir, err}); | ||
} | ||
if (opts.strict) throw err; | ||
results.push({path: dir, err}); | ||
} | ||
@@ -190,3 +178,3 @@ if (!dirents.length) return results; | ||
const path = makePath(dirent, dir, encoding); | ||
if (excludeMatcher && excludeMatcher(encoding === "buffer" ? String(path) : path)) continue; | ||
if (excludeMatcher?.(encoding === "buffer" ? String(path) : path)) continue; | ||
@@ -193,0 +181,0 @@ const isSymbolicLink = opts.followSymlinks && dirent.isSymbolicLink(); |
{ | ||
"name": "rrdir", | ||
"version": "10.0.1", | ||
"version": "10.0.2", | ||
"description": "Recursive directory reader with a delightful API", | ||
@@ -5,0 +5,0 @@ "author": "silverwind <me@silverwind.io>", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10889
172