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

readdirp

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

readdirp - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

12

package.json
{
"author": "Thorsten Lorenz <thlorenz@gmx.de> (thorstenlorenz.wordpress.com)",
"name": "readdirp",
"description": "Recursive versions of fs module functions.",
"version": "0.1.0",
"description": "Recursive version of fs.readdir.",
"version": "0.1.1",
"homepage": "https://github.com/thlorenz/readdirp",

@@ -11,2 +11,10 @@ "repository": {

},
"keywords": [
"recursive",
"fs",
"readdir",
"filesystem",
"find",
"filter"
],
"main": "readdirp.js",

@@ -13,0 +21,0 @@ "scripts": {

90

README.md

@@ -0,1 +1,15 @@

# readdirp [![Build Status](https://secure.travis-ci.org/thlorenz/readdirp.png)](http://travis-ci.org/thlorenz/readdirp)
Recursive version of [fs.readdir](http://nodejs.org/docs/latest/api/fs.html#fs_fs_readdir_path_callback).
```javascript
var readdirp = require('readdirp');
readdirp({ root: './test/bed', fileFilter: '*.js' }, function (err, res) {
// do something with JavaScript files and all directories
});
```
Meant to be one of the recursive versions of [fs](http://nodejs.org/docs/latest/api/fs.html) functions, e.g., like [mkdirp](https://github.com/substack/node-mkdirp).
**Table of Contents** *generated with [DocToc](http://doctoc.herokuapp.com/)*

@@ -11,10 +25,4 @@

- [Filters](#filters)
- [Examples](#examples)
- [More Examples](#more-examples)
# readdirp [![Build Status](https://secure.travis-ci.org/thlorenz/readdirp.png)](http://travis-ci.org/thlorenz/readdirp)
Recursive version of [fs.readdir](http://nodejs.org/docs/latest/api/fs.html#fs_fs_readdir_path_callback).
Meant to be one of the recursive versions of fs functions, e.g., like [mkdirp](https://github.com/substack/node-mkdirp).
# Installation

@@ -97,44 +105,44 @@

## Examples
# More Examples
```javascript
var readdirp = require('readdirp');
var readdirp = require('readdirp');
// Glob file filter
readdirp(opts( { root: './test/bed', fileFilter: '*.js' } ), function (err, res) {
// do something with JavaScript files and all directories
});
// Glob file filter
readdirp({ root: './test/bed', fileFilter: '*.js' }, function (err, res) {
// do something with JavaScript files and all directories
});
// Combined glob file filters
readdirp(opts( { root: './test/bed', fileFilter: [ '*.js', '*.json' ] } ), function (err, res) {
// do something with JavaScript and Json files and all directories
});
// Combined glob file filters
readdirp({ root: './test/bed', fileFilter: [ '*.js', '*.json' ] }, function (err, res) {
// do something with JavaScript and Json files and all directories
});
// Combined negated directory filters
readdirp(opts( { root: './test/bed', directoryFilter: [ '!.git', '!*modules' ] } ), function (err, res) {
// do something with all files and directories found outside '.git' or any modules directory
});
// Combined negated directory filters
readdirp({ root: './test/bed', directoryFilter: [ '!.git', '!*modules' ] }, function (err, res) {
// do something with all files and directories found outside '.git' or any modules directory
});
// Function directory filter
readdirp(
opts( { root: './test/bed', directoryFilter: function (di) { return di.name.length === 9; } }),
function (err, res) {
// do something with all files and directories found inside or matching directories whose name has length 9
})
// Function directory filter
readdirp(
{ root: './test/bed', directoryFilter: function (di) { return di.name.length === 9; } },
function (err, res) {
// do something with all files and directories found inside or matching directories whose name has length 9
})
// Limiting depth
readdirp({ root: './test/bed', depth: 1 }, function (err, res) {
// do something with all files and directories found up to 1 subdirectory deep
});
// Limiting depth
readdirp({ root: './test/bed', depth: 1 }, function (err, res) {
// do something with all files and directories found up to 1 subdirectory deep
});
// Using file processed callback
readdirp(
{ root: '.' }
, function(fileInfo) {
// do something with file here
}
, function (err, res) {
// all done, move on or do final step for all files and directories here
}
);
// Using file processed callback
readdirp(
{ root: '.' }
, function(fileInfo) {
// do something with file here
}
, function (err, res) {
// all done, move on or do final step for all files and directories here
}
);
```

@@ -141,0 +149,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