finddown-sync
Version:
Recursive downward search for all files matching a given pattern from the current directory and child directories
69 lines (45 loc) • 2.64 kB
Markdown
in the current directory or child directories. The sibling and opposite function to [findup-sync].
Matching is done with [micromatch], please report any matching related issues on that repository.
```bash
$ npm install --save finddown-sync
```
```js
var findDown = require('finddown-sync');
findDown(patternOrPatterns [, micromatchOptions]);
// Start looking in the CWD.
var filepath1 = findDown('{a,b}*.txt');
// Start looking somewhere else, and ignore case.
var filepath2 = findDown('{a,b}*.txt', {cwd: '/some/path', nocase: true});
// Start looking somewhere else, and ignore specific files or directories.
var filepath3 = findDown('{a,b}*.txt', {cwd: '/some/path', exclude: ['directory/', 'some.file']});
```
* `patterns` **{String|Array}**: Glob pattern(s) or file path(s) to match against.
* `options` **{Object}**: Options to pass to [micromatch] and [exclude-match]. Note that if you want to start in a different directory than the current working directory, specify a `cwd` property here. Files and Directories can be excluded by specifying an `exclude` property.
* `returns` **{Array}**: Returns a list of matching files.
Install dev dependencies:
```bash
$ npm install -d && npm test
```
Take care to maintain the existing coding style. Add unit tests for any new or changed functionality.
For bugs or feature requests, [please create an issue](https://github.com/chan1ks/finddown-sync/issues).
2016-10-06 - v1.0.2 - Modified CI build config.
2016-10-06 - v1.0.1 - Updated README build status.
2016-10-06 - v1.0.0 - Updated README. Refactored for [exclusion-match].
2016-10-01 - v0.2.0 - Updated dependencies. Deprecated exclude function and moved it into a separate dependency.
2016-09-20 - v0.1.0 - Initial release.
**"Captain" Morgan Worrell**
+ [github/chan1ks](https://github.com/chan1ks)
+ [twitter/chan1ks](http://twitter.com/chan1ks)
Copyright © 2016, ["Captain" Morgan Worrell](https://github.com/chan1ks).
Released under the [MIT license](https://github.com/chan1ks/finddown-sync/blob/master/LICENSE).
[ ]: http://github.com/jonschlinkert/micromatch
[ ]: https://www.npmjs.com/package/findup-sync
[ ]: https://www.npmjs.com/package/exclude-match
> Find all files matching a given pattern