lhl 8884f64fe1 10-8 | 3 anni fa | |
---|---|---|
.. | ||
index.js | 3 anni fa | |
license | 3 anni fa | |
package.json | 3 anni fa | |
readme.md | 3 anni fa |
Find a file or directory by walking up parent directories
$ npm install find-up
/
└── Users
└── sindresorhus
├── unicorn.png
└── foo
└── bar
├── baz
└── example.js
example.js
const findUp = require('find-up');
(async () => {
console.log(await findUp('unicorn.png'));
//=> '/Users/sindresorhus/unicorn.png'
console.log(await findUp(['rainbow.png', 'unicorn.png']));
//=> '/Users/sindresorhus/unicorn.png'
})();
Returns a Promise
for either the filepath or null
if it couldn't be found.
Returns a Promise
for either the first filepath found (by respecting the order) or null
if none could be found.
Returns a filepath or null
.
Returns the first filepath found (by respecting the order) or null
.
Type: string
Filename of the file to find.
Type: Object
Type: string
Default: process.cwd()
Directory to start from.
require.resolve()
but from a given pathMIT © Sindre Sorhus