0.2.1 • Published 8 years ago
pattern-file-search v0.2.1
Pattern File Search
Recursively searches a directory for files matching a pattern, optionally ignoring a pattern.
FAQ
Why would I use this instead of jergason/recursive-read-dir
- We have inclusive pattern matching. Use this to do things like "find all the javascript files in this directory"
- Our comments don't say "woop woop", like a Juggalo
- We have a depencency on caolan/async, so your build will be more robust (read: larger, bloated)
What exactly do the patterns match?
The include pattern matches only the filename. The exclude pattern matches the filename, or any directory in the path (but only one path segment at a time).
Usage
// List everything
var fileList = require('pattern-file-search')
fileList('/some/base/directory', function(err, list) {
// boom
})
// List everything matching pattern
fileList('/some/base/directory', /pattern.to.match/, function(err, list) {
// boom
})
// Exclude files matching pattern
fileList('/some/base/directory', /pattern.to.match/, /pattern.to.exclude/, function(err, list) {
// boom
})