\begin{quote}
Check if a path exists \end{quote}
Because \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}}, but 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_path_exists_readme_autotoc_md20277}{}\doxysection{Install}\label{md_sfcode_node_modules_path_exists_readme_autotoc_md20277}

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

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

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

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_path_exists_readme_autotoc_md20279}{}\doxysection{API}\label{md_sfcode_node_modules_path_exists_readme_autotoc_md20279}
\hypertarget{md_sfcode_node_modules_path_exists_readme_autotoc_md20280}{}\doxysubsection{path\+Exists(path)}\label{md_sfcode_node_modules_path_exists_readme_autotoc_md20280}
Returns a promise for a boolean of whether the path exists.\hypertarget{md_sfcode_node_modules_path_exists_readme_autotoc_md20281}{}\doxysubsection{path\+Exists.\+sync(path)}\label{md_sfcode_node_modules_path_exists_readme_autotoc_md20281}
Returns a boolean of whether the path exists.\hypertarget{md_sfcode_node_modules_path_exists_readme_autotoc_md20282}{}\doxysection{Related}\label{md_sfcode_node_modules_path_exists_readme_autotoc_md20282}

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