JSPM

fs-find-root

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1736
  • Score
    100M100P100Q112694F
  • License MIT

search up directories

Package Exports

  • fs-find-root

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (fs-find-root) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

fs-find-root

Build Status

search up directories until you find what you're looking for

usage

var find = require('fs-find-root')

  • find('dir', name, starting_directory, callback) searches for directory name starting from start_directory and calls callback with the results.
  • find.dir(name, starting_directory, callback) is equivalent to the above.
  • find('file', name, starting_directory, callback) searches for file name starting from start_directory and calls callback with the results.
  • find.file(name, starting_directory, callback) is equivalent to the above.

example

var find = require('fs-find-root')

// find a directory!
find.dir('.git', process.cwd(), function(err, found) {
  if (err) return err
  console.log('found the root of your git repo @ ' + found)
})

// find a file!
find.file('package.json', process.cwd(), function(err, found) {
  if (err) return err
  console.log('found yer package.json right here: ' + found)
})

license

MIT