Vincent Sima 1517fc9a2f done | 6 лет назад | |
---|---|---|
.. | ||
index.js | 6 лет назад | |
license | 6 лет назад | |
package.json | 6 лет назад | |
readme.md | 6 лет назад |
Find a file by walking up parent directories
$ npm install --save find-up
/
└── Users
└── sindresorhus
├── unicorn.png
└── foo
└── bar
├── baz
└── example.js
// example.js
const findUp = require('find-up');
findUp('unicorn.png').then(filepath => {
console.log(filepath);
//=> '/Users/sindresorhus/unicorn.png'
});
Returns a promise for the filepath or null
.
Returns a filepath or null
.
Type: string
Filename of the file to find.
Type: string
Default: process.cwd()
Directory to start from.
MIT © Sindre Sorhus