Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

find-file-recursively-up

mateodelnorte15ISC1.1.5

returns the path at which a provided filename exists, checking the current directory and any parent folders recursively up

find, file, recursively, up

readme

find-file-recursively-up

Build Status Greenkeeper badge

returns the path at which a provided filename exists, checking the current directory and any parent folders recursively up.

Usage

const find = require('find-file-recursively-up');

find('.meta', (err, foundPath) {
  // returns null '/Users/mateodelnorte/development/meta/.meta'
});

Yields undefined if no file found on path to /:

> DEBUG="*" node
 require('find-file-recursively-up')('.metaasdf', console.log)

  loop:find-file-recursively-up looking for .metaasdf at /Users/mateodelnorte/development/meta/plugins/loop-things/.metaasdf +0ms
  loop:find-file-recursively-up looking for .metaasdf at /Users/mateodelnorte/development/meta/plugins/.metaasdf +1ms
  loop:find-file-recursively-up looking for .metaasdf at /Users/mateodelnorte/development/meta/.metaasdf +1ms
  loop:find-file-recursively-up looking for .metaasdf at /Users/mateodelnorte/development/.metaasdf +0ms
  loop:find-file-recursively-up looking for .metaasdf at /Users/mateodelnorte/.metaasdf +0ms
  loop:find-file-recursively-up looking for .metaasdf at /Users/.metaasdf +0ms
  loop:find-file-recursively-up looking for .metaasdf at /.metaasdf +0ms

undefined