Find a file by walking down parent directories
MPL-2.0 License
Find a file by walking down parent directories.
$HOME
.indexOf
is to lastIndexOf
.npm install find-down --save
Get it into your program.
const findDown = require('find-down');
Find the topmost file with the given name.
findDown('unicorn.png').then((filepath) => {
console.log(filepath); // => '/Users/sholladay/unicorn.png'
});
Returns a Promise
for either the filepath or null
if it cannot be found.
Returns a Promise
for either the first filepath found (by respecting the order) or null
if none could be found.
Type: string
Filename of the file to find.
Type: string
Default: process.cwd()
Directory to end with.
See our contributing guidelines for more details.
git checkout -b my-new-feature
git commit -am 'Add some feature'
git push origin my-new-feature
Go make something, dang it.