\begin{quote}
Get the first path that exists on disk of multiple paths \end{quote}
\hypertarget{md_sfcode_node_modules_locate_path_readme_autotoc_md16140}{}\doxysection{Install}\label{md_sfcode_node_modules_locate_path_readme_autotoc_md16140}

\begin{DoxyCode}{0}
\DoxyCodeLine{\$ npm install locate-\/path }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_locate_path_readme_autotoc_md16141}{}\doxysection{Usage}\label{md_sfcode_node_modules_locate_path_readme_autotoc_md16141}
Here we find the first file that exists on disk, in array order.


\begin{DoxyCode}{0}
\DoxyCodeLine{const locatePath = require('locate-\/path');}
\DoxyCodeLine{}
\DoxyCodeLine{const files = [}
\DoxyCodeLine{    'unicorn.png',}
\DoxyCodeLine{    'rainbow.png', // Only this one actually exists on disk}
\DoxyCodeLine{    'pony.png'}
\DoxyCodeLine{];}
\DoxyCodeLine{}
\DoxyCodeLine{(async () => \{}
\DoxyCodeLine{    console(await locatePath(files));}
\DoxyCodeLine{    //=> 'rainbow'}
\DoxyCodeLine{\})(); }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_locate_path_readme_autotoc_md16142}{}\doxysection{API}\label{md_sfcode_node_modules_locate_path_readme_autotoc_md16142}
\hypertarget{md_sfcode_node_modules_locate_path_readme_autotoc_md16143}{}\doxysubsection{locate\+Path(input, \mbox{[}options\mbox{]})}\label{md_sfcode_node_modules_locate_path_readme_autotoc_md16143}
Returns a {\ttfamily Promise} for the first path that exists or {\ttfamily undefined} if none exists.\hypertarget{md_sfcode_node_modules_locate_path_readme_autotoc_md16144}{}\doxysubsubsection{input}\label{md_sfcode_node_modules_locate_path_readme_autotoc_md16144}
Type\+: {\ttfamily Iterable$<$string$>$}

Paths to check.\hypertarget{md_sfcode_node_modules_locate_path_readme_autotoc_md16145}{}\doxysubsubsection{options}\label{md_sfcode_node_modules_locate_path_readme_autotoc_md16145}
Type\+: {\ttfamily Object}\hypertarget{md_sfcode_node_modules_locate_path_readme_autotoc_md16146}{}\doxyparagraph{concurrency}\label{md_sfcode_node_modules_locate_path_readme_autotoc_md16146}
Type\+: {\ttfamily number}~\newline
 Default\+: {\ttfamily Infinity}~\newline
 Minimum\+: {\ttfamily 1}

Number of concurrently pending promises.\hypertarget{md_sfcode_node_modules_locate_path_readme_autotoc_md16147}{}\doxyparagraph{preserve\+Order}\label{md_sfcode_node_modules_locate_path_readme_autotoc_md16147}
Type\+: {\ttfamily boolean}~\newline
 Default\+: {\ttfamily true}

Preserve {\ttfamily input} order when searching.

Disable this to improve performance if you don\textquotesingle{}t care about the order.\hypertarget{md_sfcode_node_modules_locate_path_readme_autotoc_md16148}{}\doxyparagraph{cwd}\label{md_sfcode_node_modules_locate_path_readme_autotoc_md16148}
Type\+: {\ttfamily string}~\newline
 Default\+: {\ttfamily process.\+cwd()}

Current working directory.\hypertarget{md_sfcode_node_modules_locate_path_readme_autotoc_md16149}{}\doxysubsection{locate\+Path.\+sync(input, \mbox{[}options\mbox{]})}\label{md_sfcode_node_modules_locate_path_readme_autotoc_md16149}
Returns the first path that exists or {\ttfamily undefined} if none exists.\hypertarget{md_sfcode_node_modules_locate_path_readme_autotoc_md16150}{}\doxysubsubsection{input}\label{md_sfcode_node_modules_locate_path_readme_autotoc_md16150}
Type\+: {\ttfamily Iterable$<$string$>$}

Paths to check.\hypertarget{md_sfcode_node_modules_locate_path_readme_autotoc_md16151}{}\doxysubsubsection{options}\label{md_sfcode_node_modules_locate_path_readme_autotoc_md16151}
Type\+: {\ttfamily Object}\hypertarget{md_sfcode_node_modules_locate_path_readme_autotoc_md16152}{}\doxyparagraph{cwd}\label{md_sfcode_node_modules_locate_path_readme_autotoc_md16152}
Same as above.\hypertarget{md_sfcode_node_modules_locate_path_readme_autotoc_md16153}{}\doxysection{Related}\label{md_sfcode_node_modules_locate_path_readme_autotoc_md16153}

\begin{DoxyItemize}
\item \href{https://github.com/sindresorhus/path-exists}{\texttt{ path-\/exists}} -\/ Check if a path exists
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_locate_path_readme_autotoc_md16154}{}\doxysection{License}\label{md_sfcode_node_modules_locate_path_readme_autotoc_md16154}
MIT © \href{https://sindresorhus.com}{\texttt{ Sindre Sorhus}} 