find-in-directory
v1.0.1
Published
Find file or directory by names in a directory.
Downloads
3
Readme
find-in-directory
Find file or directory by names in a directory.
Install
yarn add find-in-directory
Usage
import {findFile, findDirectory} from 'find-in-directory'
const file = await findFile(process.cwd(), [
'package.json',
'package.json5',
'package.yaml',
])
// "/path/to/package.json"
API
{findFile, findDirectory}(directory, nameOrNames, predicate?, options?)
directory
The directory to find.
Type: URL | string
nameOrNames
The file/directory name or names to find.
Type: string[] | string
predicate
Type: (path: string) => Promise<boolean>
options
options.allowSymlinks
Should allow symlinks or not.
Type: boolean