\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_karma_node_modules_path_exists_readme_autotoc_md15138}{}\doxysection{Install}\label{md_sfcode_node_modules_karma_node_modules_path_exists_readme_autotoc_md15138}

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

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

\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_karma_node_modules_path_exists_readme_autotoc_md15140}{}\doxysection{API}\label{md_sfcode_node_modules_karma_node_modules_path_exists_readme_autotoc_md15140}
\hypertarget{md_sfcode_node_modules_karma_node_modules_path_exists_readme_autotoc_md15141}{}\doxysubsection{path\+Exists(path)}\label{md_sfcode_node_modules_karma_node_modules_path_exists_readme_autotoc_md15141}
Returns a {\ttfamily Promise$<$boolean$>$} of whether the path exists.\hypertarget{md_sfcode_node_modules_karma_node_modules_path_exists_readme_autotoc_md15142}{}\doxysubsection{path\+Exists.\+sync(path)}\label{md_sfcode_node_modules_karma_node_modules_path_exists_readme_autotoc_md15142}
Returns a {\ttfamily boolean} of whether the path exists.\hypertarget{md_sfcode_node_modules_karma_node_modules_path_exists_readme_autotoc_md15143}{}\doxysection{Related}\label{md_sfcode_node_modules_karma_node_modules_path_exists_readme_autotoc_md15143}

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