
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
deep-list-dir
Advanced tools
Recursively lists given directory, alternatively filtering results with given options
Deeply lists a directory filtering files by given pattern(s)
This module recursively lists all files in given directory (including sub-folders) by early filtering the results using the
given pattern which can be an array of minimatch
expressions or RegExp.
It will return all matching results. minimatch negative patterns are used to explicitly exclude a path from being scan / returned.
Take the following file structure:
<directory>
├── dir1
│ └── README.md
├── dir2
│ └── sub-dir2
│ ├── hi.txt
│ └── index.js
├── index.js
└── README.md
...and the following script:
const { deepListDir, deepListDirSync } = require('deep-list-dir')
deepListDir('<directory>',
{
pattern: ['*.md'], // minimatch or RegExp
// base: '', set parent base to something different than given directory
// minimatchOptions: { matchBase: true } // minimatch options
}
).then(console.log)
Will output
[
"dir1/README.md",
"README.md"
]
A sync version is also provided:
console.log(deepListDirSync('<directory>', { pattern: '*.js'}))
Output:
[
"dir2/sub-dir2/index.js",
"index.js"
]
© 2020-present Martin Rafael Gonzalez tin@devtin.io
FAQs
Recursively lists given directory, alternatively filtering results with given options
We found that deep-list-dir demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.