\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_protractor_node_modules_path_exists_readme_autotoc_md22841}{}\doxysection{Install}\label{md_sfcode_node_modules_protractor_node_modules_path_exists_readme_autotoc_md22841}

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

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

\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_protractor_node_modules_path_exists_readme_autotoc_md22843}{}\doxysection{API}\label{md_sfcode_node_modules_protractor_node_modules_path_exists_readme_autotoc_md22843}
\hypertarget{md_sfcode_node_modules_protractor_node_modules_path_exists_readme_autotoc_md22844}{}\doxysubsection{path\+Exists(path)}\label{md_sfcode_node_modules_protractor_node_modules_path_exists_readme_autotoc_md22844}
Returns a {\ttfamily Promise$<$boolean$>$} of whether the path exists.\hypertarget{md_sfcode_node_modules_protractor_node_modules_path_exists_readme_autotoc_md22845}{}\doxysubsection{path\+Exists.\+sync(path)}\label{md_sfcode_node_modules_protractor_node_modules_path_exists_readme_autotoc_md22845}
Returns a {\ttfamily boolean} of whether the path exists.\hypertarget{md_sfcode_node_modules_protractor_node_modules_path_exists_readme_autotoc_md22846}{}\doxysection{Related}\label{md_sfcode_node_modules_protractor_node_modules_path_exists_readme_autotoc_md22846}

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