Gathering detailed insights and metrics for find-up
Gathering detailed insights and metrics for find-up
Gathering detailed insights and metrics for find-up
Gathering detailed insights and metrics for find-up
Find a file or directory by walking up parent directories
npm install find-up
Typescript
Module System
Min. Node Version
Node Version
NPM Version
JavaScript (56.04%)
TypeScript (43.96%)
Total Downloads
27,699,586,366
Last Day
9,512,044
Last Week
159,005,725
Last Month
685,528,547
Last Year
6,954,424,702
MIT License
616 Stars
72 Commits
44 Forks
10 Watchers
1 Branches
16 Contributors
Updated on Jul 03, 2025
Minified
Minified + Gzipped
Latest Version
7.0.0
Package Id
find-up@7.0.0
Unpacked Size
16.10 kB
Size
3.79 kB
File Count
5
NPM Version
9.2.0
Node Version
18.18.2
Published on
Nov 16, 2023
Cumulative downloads
Total Downloads
Last Day
-8.7%
9,512,044
Compared to previous day
Last Week
-8%
159,005,725
Compared to previous week
Last Month
3.9%
685,528,547
Compared to previous month
Last Year
13.8%
6,954,424,702
Compared to previous year
3
5
Find a file or directory by walking up parent directories
1npm install find-up
/
└── Users
└── sindresorhus
├── unicorn.png
└── foo
└── bar
├── baz
└── example.js
example.js
1import path from 'node:path'; 2import {findUp, pathExists} from 'find-up'; 3 4console.log(await findUp('unicorn.png')); 5//=> '/Users/sindresorhus/unicorn.png' 6 7console.log(await findUp(['rainbow.png', 'unicorn.png'])); 8//=> '/Users/sindresorhus/unicorn.png' 9 10console.log(await findUp(async directory => { 11 const hasUnicorns = await pathExists(path.join(directory, 'unicorn.png')); 12 return hasUnicorns && directory; 13}, {type: 'directory'})); 14//=> '/Users/sindresorhus'
Returns a Promise
for either the path or undefined
if it could not be found.
Returns a Promise
for either the first path found (by respecting the order of the array) or undefined
if none could be found.
Returns a Promise
for either an array of paths or an empty array if none could be found.
Returns a Promise
for either an array of the first paths found (by respecting the order of the array) or an empty array if none could be found.
Returns a path or undefined
if it could not be found.
Returns the first path found (by respecting the order of the array) or undefined
if none could be found.
Returns an array of paths or an empty array if none could be found.
Returns an array of the first paths found (by respecting the order of the array) or an empty array if none could be found.
Type: string
The name of the file or directory to find.
Type: Function
A function that will be called with each directory until it returns a string
with the path, which stops the search, or the root directory has been reached and nothing was found. Useful if you want to match files with certain patterns, set of permissions, or other advanced use-cases.
When using async mode, the matcher
may optionally be an async or promise-returning function that returns the path.
Type: object
Type: URL | string
Default: process.cwd()
The directory to start from.
Type: string
Default: 'file'
Values: 'file' | 'directory'
The type of path to match.
Type: boolean
Default: true
Allow symbolic links to match if they point to the chosen path type.
Type: URL | string
Default: Root directory
A directory path where the search halts if no matches are found before reaching this point.
Returns a Promise<boolean>
of whether the path exists.
Returns a boolean
of whether the path exists.
Type: string
The path to a file or directory.
A Symbol
that can be returned by a matcher
function to stop the search and cause findUp
to immediately return undefined
. Useful as a performance optimization in case the current working directory is deeply nested in the filesystem.
1import path from 'node:path'; 2import {findUp, findUpStop} from 'find-up'; 3 4await findUp(directory => { 5 return path.basename(directory) === 'work' ? findUpStop : 'logo.png'; 6});
require.resolve()
but from a given pathNo vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
security policy file detected
Details
Reason
license file detected
Details
Reason
0 existing vulnerabilities detected
Reason
Found 10/30 approved changesets -- score normalized to 3
Reason
1 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-06-23
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More