lhl 2576c8578e 1-13-1 | преди 2 години | |
---|---|---|
.. | ||
index.js | преди 2 години | |
license | преди 2 години | |
package.json | преди 2 години | |
readme.md | преди 2 години |
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