\begin{quote}
Check if a path exists \end{quote}
NOTE\+: {\ttfamily fs.\+exists\+Sync} has been un-\/deprecated in Node.\+js since 6.\+8.\+0. If you only need to check synchronously, this module is not needed.

While \href{https://nodejs.org/api/fs.html\#fs_fs_exists_path_callback}{\texttt{ {\ttfamily fs.\+exists()}}} is being \href{https://github.com/iojs/io.js/issues/103}{\texttt{ deprecated}}, there\textquotesingle{}s still a genuine use-\/case of being able to check if a path exists for other purposes than doing IO with it.

Never use this before handling a file though\+:

\begin{quote}
In particular, checking if a file exists before opening it is an anti-\/pattern that leaves you vulnerable to race conditions\+: another process may remove the file between the calls to {\ttfamily fs.\+exists()} and {\ttfamily fs.\+open()}. Just open the file and handle the error when it\textquotesingle{}s not there. \end{quote}
\hypertarget{md_sfcode_node_modules_find_cache_dir_node_modules_path_exists_readme_autotoc_md10726}{}\doxysection{Install}\label{md_sfcode_node_modules_find_cache_dir_node_modules_path_exists_readme_autotoc_md10726}

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

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_find_cache_dir_node_modules_path_exists_readme_autotoc_md10727}{}\doxysection{Usage}\label{md_sfcode_node_modules_find_cache_dir_node_modules_path_exists_readme_autotoc_md10727}

\begin{DoxyCode}{0}
\DoxyCodeLine{// foo.js}
\DoxyCodeLine{const pathExists = require('path-\/exists');}
\DoxyCodeLine{}
\DoxyCodeLine{(async () => \{}
\DoxyCodeLine{    console.log(await pathExists('foo.js'));}
\DoxyCodeLine{    //=> true}
\DoxyCodeLine{\})(); }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_find_cache_dir_node_modules_path_exists_readme_autotoc_md10728}{}\doxysection{API}\label{md_sfcode_node_modules_find_cache_dir_node_modules_path_exists_readme_autotoc_md10728}
\hypertarget{md_sfcode_node_modules_find_cache_dir_node_modules_path_exists_readme_autotoc_md10729}{}\doxysubsection{path\+Exists(path)}\label{md_sfcode_node_modules_find_cache_dir_node_modules_path_exists_readme_autotoc_md10729}
Returns a {\ttfamily Promise$<$boolean$>$} of whether the path exists.\hypertarget{md_sfcode_node_modules_find_cache_dir_node_modules_path_exists_readme_autotoc_md10730}{}\doxysubsection{path\+Exists.\+sync(path)}\label{md_sfcode_node_modules_find_cache_dir_node_modules_path_exists_readme_autotoc_md10730}
Returns a {\ttfamily boolean} of whether the path exists.\hypertarget{md_sfcode_node_modules_find_cache_dir_node_modules_path_exists_readme_autotoc_md10731}{}\doxysection{Related}\label{md_sfcode_node_modules_find_cache_dir_node_modules_path_exists_readme_autotoc_md10731}

\begin{DoxyItemize}
\item \href{https://github.com/sindresorhus/path-exists-cli}{\texttt{ path-\/exists-\/cli}} -\/ CLI for this module
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_find_cache_dir_node_modules_path_exists_readme_autotoc_md10732}{}\doxysection{License}\label{md_sfcode_node_modules_find_cache_dir_node_modules_path_exists_readme_autotoc_md10732}
MIT © \href{https://sindresorhus.com}{\texttt{ Sindre Sorhus}} 