locate-path (2024)

Get the first path that exists on disk of multiple paths

Install

$ npm install locate-path

Usage

Here we find the first file that exists on disk, in array order.

import {locatePath} from 'locate-path';const files = ['unicorn.png','rainbow.png', // Only this one actually exists on disk'pony.png'];console(await locatePath(files));//=> 'rainbow'

API

locatePath(paths, options?)

Returns a Promise<string> for the first path that exists or undefined if none exists.

paths

Type: Iterable<string>

The paths to check.

options

Type: object

concurrency

Type: number
Default: Infinity
Minimum: 1

The number of concurrently pending promises.

preserveOrder

Type: boolean
Default: true

Preserve paths order when searching.

Disable this to improve performance if you don't care about the order.

cwd

Type: URL | string
Default: process.cwd()

The current working directory.

type

Type: string
Default: 'file'
Values: 'file' | 'directory'

The type of paths that can match.

allowSymlinks

Type: boolean
Default: true

Allow symbolic links to match if they point to the chosen path type.

locatePathSync(paths, options?)

Returns the first path that exists or undefined if none exists.

paths

Type: Iterable<string>

The paths to check.

options

Type: object

cwd

Same as above.

type

Same as above.

allowSymlinks

Same as above.

Related

Get professional support for this package with a Tidelift subscription
Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies.

locate-path (2024)
Top Articles
Final Accounts: Meaning, Objectives, Format, Examples
What is Hedging and How it Works in Investing?
Jack Doherty Lpsg
Jazmen Jafar Linkedin
Greedfall Console Commands
How to change your Android phone's default Google account
Holly Ranch Aussie Farm
Fnv Turbo
Erin Kate Dolan Twitter
Watch TV shows online - JustWatch
Turning the System On or Off
Gwdonate Org
Guilford County | NCpedia
Bend Pets Craigslist
Roster Resource Orioles
Adam4Adam Discount Codes
Fort Mccoy Fire Map
Noaa Duluth Mn
Jeffers Funeral Home Obituaries Greeneville Tennessee
PCM.daily - Discussion Forum: Classique du Grand Duché
Bòlèt Florida Midi 30
Wonder Film Wiki
Nearest Ups Ground Drop Off
3 Ways to Drive Employee Engagement with Recognition Programs | UKG
Vivification Harry Potter
Meggen Nut
Darktide Terrifying Barrage
Trust/Family Bank Contingency Plan
Dtlr On 87Th Cottage Grove
Citibank Branch Locations In Orlando Florida
Flixtor Nu Not Working
Flaky Fish Meat Rdr2
24 slang words teens and Gen Zers are using in 2020, and what they really mean
Craigslist Albany Ny Garage Sales
Family Fare Ad Allendale Mi
42 Manufacturing jobs in Grayling
Sadie Sink Doesn't Want You to Define Her Style, Thank You Very Much
Gpa Calculator Georgia Tech
Insideaveritt/Myportal
15 Best Things to Do in Roseville (CA) - The Crazy Tourist
Suffix With Pent Crossword Clue
The Largest Banks - ​​How to Transfer Money With Only Card Number and CVV (2024)
Pink Runtz Strain, The Ultimate Guide
What Is The Optavia Diet—And How Does It Work?
Bridgeport Police Blotter Today
Craigslist Chautauqua Ny
bot .com Project by super soph
Missed Connections Dayton Ohio
Shannon Sharpe Pointing Gif
Spn 3464 Engine Throttle Actuator 1 Control Command
Latest Posts
Article information

Author: Fredrick Kertzmann

Last Updated:

Views: 5632

Rating: 4.6 / 5 (46 voted)

Reviews: 85% of readers found this page helpful

Author information

Name: Fredrick Kertzmann

Birthday: 2000-04-29

Address: Apt. 203 613 Huels Gateway, Ralphtown, LA 40204

Phone: +2135150832870

Job: Regional Design Producer

Hobby: Nordic skating, Lacemaking, Mountain biking, Rowing, Gardening, Water sports, role-playing games

Introduction: My name is Fredrick Kertzmann, I am a gleaming, encouraging, inexpensive, thankful, tender, quaint, precious person who loves writing and wants to share my knowledge and understanding with you.