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 by walking up parent directories
9 $ npm install --save find-up
28 const findUp = require('find-up');
30 findUp('unicorn.png').then(filepath => {
31 console.log(filepath);
32 //=> '/Users/sindresorhus/unicorn.png'
35 findUp(['rainbow.png', 'unicorn.png']).then(filepath => {
36 console.log(filepath);
37 //=> '/Users/sindresorhus/unicorn.png'
44 ### findUp(filename, [options])
46 Returns a `Promise` for the filepath or `null`.
48 ### findUp([filenameA, filenameB], [options])
50 Returns a `Promise` for the first filepath found (by respecting the order) or `null`.
52 ### findUp.sync(filename, [options])
54 Returns a filepath or `null`.
56 ### findUp.sync([filenameA, filenameB], [options])
58 Returns the first filepath found (by respecting the order) or `null`.
64 Filename of the file to find.
71 Default: `process.cwd()`
73 Directory to start from.
78 - [find-up-cli](https://github.com/sindresorhus/find-up-cli) - CLI for this module
79 - [pkg-up](https://github.com/sindresorhus/pkg-up) - Find the closest package.json file
80 - [pkg-dir](https://github.com/sindresorhus/pkg-dir) - Find the root directory of an npm package
85 MIT © [Sindre Sorhus](https://sindresorhus.com)