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

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

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_find_cache_dir_node_modules_locate_path_readme_autotoc_md10682}{}\doxysection{Usage}\label{md_sfcode_node_modules_find_cache_dir_node_modules_locate_path_readme_autotoc_md10682}
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_find_cache_dir_node_modules_locate_path_readme_autotoc_md10683}{}\doxysection{API}\label{md_sfcode_node_modules_find_cache_dir_node_modules_locate_path_readme_autotoc_md10683}
\hypertarget{md_sfcode_node_modules_find_cache_dir_node_modules_locate_path_readme_autotoc_md10684}{}\doxysubsection{locate\+Path(paths, \mbox{[}options\mbox{]})}\label{md_sfcode_node_modules_find_cache_dir_node_modules_locate_path_readme_autotoc_md10684}
Returns a {\ttfamily Promise$<$string$>$} for the first path that exists or {\ttfamily undefined} if none exists.\hypertarget{md_sfcode_node_modules_find_cache_dir_node_modules_locate_path_readme_autotoc_md10685}{}\doxysubsubsection{paths}\label{md_sfcode_node_modules_find_cache_dir_node_modules_locate_path_readme_autotoc_md10685}
Type\+: {\ttfamily Iterable$<$string$>$}

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

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

Preserve {\ttfamily paths} order when searching.

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

Current working directory.\hypertarget{md_sfcode_node_modules_find_cache_dir_node_modules_locate_path_readme_autotoc_md10690}{}\doxyparagraph{type}\label{md_sfcode_node_modules_find_cache_dir_node_modules_locate_path_readme_autotoc_md10690}
Type\+: {\ttfamily string}~\newline
 Default\+: {\ttfamily file}~\newline
 Values\+: {\ttfamily file} {\ttfamily directory}

The type of paths that can match.\hypertarget{md_sfcode_node_modules_find_cache_dir_node_modules_locate_path_readme_autotoc_md10691}{}\doxyparagraph{allow\+Symlinks}\label{md_sfcode_node_modules_find_cache_dir_node_modules_locate_path_readme_autotoc_md10691}
Type\+: {\ttfamily boolean}~\newline
 Default\+: {\ttfamily true}

Allow symbolic links to match if they point to the chosen path type.\hypertarget{md_sfcode_node_modules_find_cache_dir_node_modules_locate_path_readme_autotoc_md10692}{}\doxysubsection{locate\+Path.\+sync(paths, \mbox{[}options\mbox{]})}\label{md_sfcode_node_modules_find_cache_dir_node_modules_locate_path_readme_autotoc_md10692}
Returns the first path that exists or {\ttfamily undefined} if none exists.\hypertarget{md_sfcode_node_modules_find_cache_dir_node_modules_locate_path_readme_autotoc_md10693}{}\doxysubsubsection{paths}\label{md_sfcode_node_modules_find_cache_dir_node_modules_locate_path_readme_autotoc_md10693}
Type\+: {\ttfamily Iterable$<$string$>$}

Paths to check.\hypertarget{md_sfcode_node_modules_find_cache_dir_node_modules_locate_path_readme_autotoc_md10694}{}\doxysubsubsection{options}\label{md_sfcode_node_modules_find_cache_dir_node_modules_locate_path_readme_autotoc_md10694}
Type\+: {\ttfamily Object}\hypertarget{md_sfcode_node_modules_find_cache_dir_node_modules_locate_path_readme_autotoc_md10695}{}\doxyparagraph{cwd}\label{md_sfcode_node_modules_find_cache_dir_node_modules_locate_path_readme_autotoc_md10695}
Same as above.\hypertarget{md_sfcode_node_modules_find_cache_dir_node_modules_locate_path_readme_autotoc_md10696}{}\doxyparagraph{type}\label{md_sfcode_node_modules_find_cache_dir_node_modules_locate_path_readme_autotoc_md10696}
Same as above.\hypertarget{md_sfcode_node_modules_find_cache_dir_node_modules_locate_path_readme_autotoc_md10697}{}\doxyparagraph{allow\+Symlinks}\label{md_sfcode_node_modules_find_cache_dir_node_modules_locate_path_readme_autotoc_md10697}
Same as above.\hypertarget{md_sfcode_node_modules_find_cache_dir_node_modules_locate_path_readme_autotoc_md10698}{}\doxysection{Related}\label{md_sfcode_node_modules_find_cache_dir_node_modules_locate_path_readme_autotoc_md10698}

\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_find_cache_dir_node_modules_locate_path_readme_autotoc_md10699}{}\doxysection{License}\label{md_sfcode_node_modules_find_cache_dir_node_modules_locate_path_readme_autotoc_md10699}
MIT © \href{https://sindresorhus.com}{\texttt{ Sindre Sorhus}} 