You can see below the API reference of this module.
Searches a file/directory in parent directories.
Having the following file structure:
.
├── example
│ └── some
│ └── dir
└── package.json
Supposing you want to find the path to the first package.json
file, starting with example/some/dir
, just do
ParentSearch("path/to/some/dir", "package.json")
-
String
path
: The start directory path. -
String
search
: The file/directory to search. -
Object
options
: An object containing the following fields: -
multiple
(Boolean): Iftrue
, the search will stop only when it reaches the root directory (default:false
). -
obj
(Boolean): Iftrue
, the results will be objects, otherwise they will be strings. -
Function
callback
: The callback function. If not provided, the sync version will be used instead. This is called with an error in first argument and location object/string of the found file/directory. -
Function
progress
: The progress function. This is called with an object when the file/directory is found. The object contains: -
d
: The directory path of the found path. -
b
: The basename. -
p
: The absolute path to the file/directory. -
_
: The directory of searched path.
- Array|String|Object The location(s) that were found.