1 | # findup-sync [![Build Status](https://secure.travis-ci.org/cowboy/node-findup-sync.png?branch=master)](http://travis-ci.org/cowboy/node-findup-sync)
|
2 |
|
3 | Find the first file matching a given pattern in the current directory or the nearest ancestor directory.
|
4 |
|
5 | ## Getting Started
|
6 | Install the module with: `npm install findup-sync`
|
7 |
|
8 | ```js
|
9 | var findup = require('findup-sync');
|
10 |
|
11 | // Start looking in the CWD.
|
12 | var filepath1 = findup('{a,b}*.txt');
|
13 |
|
14 | // Start looking somewhere else, and ignore case (probably a good idea).
|
15 | var filepath2 = findup('{a,b}*.txt', {cwd: '/some/path', nocase: true});
|
16 | ```
|
17 |
|
18 | ## Usage
|
19 |
|
20 | ```js
|
21 | findup(patternOrPatterns [, minimatchOptions])
|
22 | ```
|
23 |
|
24 | ### patternOrPatterns
|
25 | Type: `String` or `Array`
|
26 | Default: none
|
27 |
|
28 | One or more wildcard glob patterns. Or just filenames.
|
29 |
|
30 | ### minimatchOptions
|
31 | Type: `Object`
|
32 | Default: `{}`
|
33 |
|
34 | Options to be passed to [minimatch](https://github.com/isaacs/minimatch).
|
35 |
|
36 | Note that if you want to start in a different directory than the current working directory, specify a `cwd` property here.
|
37 |
|
38 | ## Contributing
|
39 | In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [Grunt](http://gruntjs.com/).
|
40 |
|
41 | ## Release History
|
42 | 2014-12-17 - v0.2.1 - updated to glob 4.3.
|
43 | 2014-12-16 - v0.2.0 - Removed lodash, updated to glob 4.x.
|
44 | 2014-03-14 - v0.1.3 - Updated dependencies.
|
45 | 2013-03-08 - v0.1.2 - Updated dependencies. Fixed a Node 0.9.x bug. Updated unit tests to work cross-platform.
|
46 | 2012-11-15 - v0.1.1 - Now works without an options object.
|
47 | 2012-11-01 - v0.1.0 - Initial release.
|