## Usage ```js const find = require('{%= name %}'); ``` ## async ```js find(filename, cwd, limit, callback); ``` **Example** - `filename` **String** - (required) the name of the file to find. - `cwd` **String** - (optional) the starting directory. This value can be prefixed with `~` to search from the user home directory. - `limit` **Number** - (optional) limit the number of directories to recurse. - `callback` **Functional** - (optional) A promise is returned when no callback is passed. **Promise example** ```js // use "~" to search user home find('foo.txt', '~/a/b/c') .then(file => console.log(file)) //=> '/Users/jonschlinkert/foo.txt' .catch(console.error); ``` **With async-await** ```js (async function() { const file = await find('foo.txt', '~/a/b/c'); console.log(file); //=> '/Users/jonschlinkert/foo.txt' })(); ``` **Callback example** ```js // find `foo.txt` starting at the given directory find('foo.txt', 'a/b/c', function(err, file) { if (err) throw err; console.log(file); //=> /Users/jonschlinkert/dev/find-file-up/fixtures/foo.txt }); ``` ### sync ```js find.sync(filename, cwd, limit); ``` **Example** - `filename` **String** - (required) the name of the file to find. - `cwd` **String** - (optional) the starting directory. - `limit` **Number** - (optional) limit the number of directories to recurse. ```js const file = find.sync('foo.txt', 'a/b/c/'); ```