1 # find-up [![Build Status: Linux and macOS](https://travis-ci.org/sindresorhus/find-up.svg?branch=master)](https://travis-ci.org/sindresorhus/find-up) [![Build Status: Windows](https://ci.appveyor.com/api/projects/status/l0cyjmvh5lq72vq2/branch/master?svg=true)](https://ci.appveyor.com/project/sindresorhus/find-up/branch/master)
3 > Find a file or directory by walking up parent directories
29 const findUp = require('find-up');
32 console.log(await findUp('unicorn.png'));
33 //=> '/Users/sindresorhus/unicorn.png'
35 console.log(await findUp(['rainbow.png', 'unicorn.png']));
36 //=> '/Users/sindresorhus/unicorn.png'
43 ### findUp(filename, [options])
45 Returns a `Promise` for either the filepath or `null` if it couldn't be found.
47 ### findUp([filenameA, filenameB], [options])
49 Returns a `Promise` for either the first filepath found (by respecting the order) or `null` if none could be found.
51 ### findUp.sync(filename, [options])
53 Returns a filepath or `null`.
55 ### findUp.sync([filenameA, filenameB], [options])
57 Returns the first filepath found (by respecting the order) or `null`.
63 Filename of the file to find.
72 Default: `process.cwd()`
74 Directory to start from.
79 - [find-up-cli](https://github.com/sindresorhus/find-up-cli) - CLI for this module
80 - [pkg-up](https://github.com/sindresorhus/pkg-up) - Find the closest package.json file
81 - [pkg-dir](https://github.com/sindresorhus/pkg-dir) - Find the root directory of an npm package
82 - [resolve-from](https://github.com/sindresorhus/resolve-from) - Resolve the path of a module like `require.resolve()` but from a given path
87 MIT © [Sindre Sorhus](https://sindresorhus.com)