\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__angular_compiler_cli_node_modules_path_exists_readme_autotoc_md331}{}\doxysection{Install}\label{md_sfcode_node_modules__angular_compiler_cli_node_modules_path_exists_readme_autotoc_md331}

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

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

\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__angular_compiler_cli_node_modules_path_exists_readme_autotoc_md333}{}\doxysection{API}\label{md_sfcode_node_modules__angular_compiler_cli_node_modules_path_exists_readme_autotoc_md333}
\hypertarget{md_sfcode_node_modules__angular_compiler_cli_node_modules_path_exists_readme_autotoc_md334}{}\doxysubsection{path\+Exists(path)}\label{md_sfcode_node_modules__angular_compiler_cli_node_modules_path_exists_readme_autotoc_md334}
Returns a {\ttfamily Promise$<$boolean$>$} of whether the path exists.\hypertarget{md_sfcode_node_modules__angular_compiler_cli_node_modules_path_exists_readme_autotoc_md335}{}\doxysubsection{path\+Exists.\+sync(path)}\label{md_sfcode_node_modules__angular_compiler_cli_node_modules_path_exists_readme_autotoc_md335}
Returns a {\ttfamily boolean} of whether the path exists.\hypertarget{md_sfcode_node_modules__angular_compiler_cli_node_modules_path_exists_readme_autotoc_md336}{}\doxysection{Related}\label{md_sfcode_node_modules__angular_compiler_cli_node_modules_path_exists_readme_autotoc_md336}

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