Socket
Socket
Sign inDemoInstall

readdir-glob

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

readdir-glob - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

18

index.js

@@ -37,5 +37,5 @@ module.exports = readdirGlob;

}
function stat(file, followSyslinks) {
function stat(file, followSymlinks) {
return new Promise((resolve, reject) => {
const statFunc = followSyslinks ? fs.stat : fs.lstat;
const statFunc = followSymlinks ? fs.stat : fs.lstat;
statFunc(file, (err, stats) => {

@@ -45,3 +45,3 @@ if(err) {

case 'ENOENT':
if(followSyslinks) {
if(followSymlinks) {
// Fallback to lstat to handle broken links as files

@@ -64,3 +64,3 @@ resolve(stat(file, false));

async function* exploreWalkAsync(dir, path, followSyslinks, useStat, shouldSkip, strict) {
async function* exploreWalkAsync(dir, path, followSymlinks, useStat, shouldSkip, strict) {
let files = await readdir(path + dir, strict);

@@ -79,4 +79,4 @@ for(const file of files) {

let stats = null;
if(useStat || followSyslinks) {
stats = await stat(absolute, followSyslinks);
if(useStat || followSymlinks) {
stats = await stat(absolute, followSymlinks);
}

@@ -93,3 +93,3 @@ if(!stats && file.name !== undefined) {

yield {relative, absolute, stats};
yield* exploreWalkAsync(filename, path, followSyslinks, useStat, shouldSkip, false);
yield* exploreWalkAsync(filename, path, followSymlinks, useStat, shouldSkip, false);
}

@@ -101,4 +101,4 @@ } else {

}
async function* explore(path, followSyslinks, useStat, shouldSkip) {
yield* exploreWalkAsync('', path, followSyslinks, useStat, shouldSkip, true);
async function* explore(path, followSymlinks, useStat, shouldSkip) {
yield* exploreWalkAsync('', path, followSymlinks, useStat, shouldSkip, true);
}

@@ -105,0 +105,0 @@

@@ -5,3 +5,3 @@ {

"description": "Recursive fs.readdir with streaming API and glob filtering.",
"version": "1.1.1",
"version": "1.1.2",
"homepage": "https://github.com/Yqnn/node-readdir-glob",

@@ -17,10 +17,9 @@ "repository": {

"dependencies": {
"minimatch": "^3.0.4"
"minimatch": "^5.1.0"
},
"devDependencies": {
"coveralls": "^3.1.0",
"jest": "^25.5.4",
"mkdirp": "^1.0.0",
"path-is-absolute": "^1.0.0",
"rimraf": "^2.2.8",
"jasmine": "^3.9.0",
"mkdirp": "^1.0.4",
"nyc": "^15.1.0",
"rimraf": "^3.0.2",
"tick": "0.0.6"

@@ -40,5 +39,4 @@ },

"scripts": {
"test": "jest --coverage",
"test": "npx nyc --reporter=lcov --reporter=text-summary --reporter=html jasmine --config=jasmine.json",
"test-regen": "TEST_REGEN=1 jest --coverage",
"coveralls": "jest --coverage && cat ./coverage/lcov.info | coveralls",
"bench": "bash scripts/benchmark.sh",

@@ -45,0 +43,0 @@ "profile": "bash scripts/profile.sh && cat profile.txt"

# Readdir-Glob
![Build Status](https://github.com/Yqnn/node-readdir-glob/actions/workflows/test.yml/badge.svg?branch=master) [![Coverage Status](https://coveralls.io/repos/github/Yqnn/node-readdir-glob/badge.svg?branch=master)](https://coveralls.io/github/Yqnn/node-readdir-glob?branch=master)
[![Build Status](https://travis-ci.com/Yqnn/node-readdir-glob.svg?branch=master)](https://travis-ci.com/Yqnn/node-readdir-glob) [![Coverage Status](https://coveralls.io/repos/github/Yqnn/node-readdir-glob/badge.svg?branch=master)](https://coveralls.io/github/Yqnn/node-readdir-glob?branch=master)
Recursive version of fs.readdir wih stream API and glob filtering.
Uses the `minimatch` library to do its matching.
Requires Node.js 10.0 or later.
## Performances
Compared to `glob`, `readdir-glob` is memory efficient: no matter the file system size, or the number of returned files, the memory usage is constant.
The CPU cost is proportional to the number of files in `root` folder, minus the number files in `options.skip` folders.
**Advice**: For better performances use `options.skip` to restrict the search as much as possible.
## Usage

@@ -9,0 +18,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