\begin{quote}
Find a file or directory by walking up parent directories \end{quote}
\hypertarget{md_sfcode_node_modules_find_up_readme_autotoc_md10789}{}\doxysection{Install}\label{md_sfcode_node_modules_find_up_readme_autotoc_md10789}

\begin{DoxyCode}{0}
\DoxyCodeLine{\$ npm install find-\/up }

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

\begin{DoxyCode}{0}
\DoxyCodeLine{/}
\DoxyCodeLine{└── Users}
\DoxyCodeLine{        └── sindresorhus}
\DoxyCodeLine{                ├── unicorn.png}
\DoxyCodeLine{                └── foo}
\DoxyCodeLine{                        └── bar}
\DoxyCodeLine{                                ├── baz}
\DoxyCodeLine{                                └── example.js }

\end{DoxyCode}


{\ttfamily example.\+js}


\begin{DoxyCode}{0}
\DoxyCodeLine{const findUp = require('find-\/up');}
\DoxyCodeLine{}
\DoxyCodeLine{(async () => \{}
\DoxyCodeLine{    console.log(await findUp('unicorn.png'));}
\DoxyCodeLine{    //=> '/Users/sindresorhus/unicorn.png'}
\DoxyCodeLine{}
\DoxyCodeLine{    console.log(await findUp(['rainbow.png', 'unicorn.png']));}
\DoxyCodeLine{    //=> '/Users/sindresorhus/unicorn.png'}
\DoxyCodeLine{\})(); }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_find_up_readme_autotoc_md10791}{}\doxysection{API}\label{md_sfcode_node_modules_find_up_readme_autotoc_md10791}
\hypertarget{md_sfcode_node_modules_find_up_readme_autotoc_md10792}{}\doxysubsection{find\+Up(filename, \mbox{[}options\mbox{]})}\label{md_sfcode_node_modules_find_up_readme_autotoc_md10792}
Returns a {\ttfamily Promise} for either the filepath or {\ttfamily null} if it couldn\textquotesingle{}t be found.\hypertarget{md_sfcode_node_modules_find_up_readme_autotoc_md10793}{}\doxysubsection{find\+Up(\mbox{[}filename\+A, filename\+B\mbox{]}, \mbox{[}options\mbox{]})}\label{md_sfcode_node_modules_find_up_readme_autotoc_md10793}
Returns a {\ttfamily Promise} for either the first filepath found (by respecting the order) or {\ttfamily null} if none could be found.\hypertarget{md_sfcode_node_modules_find_up_readme_autotoc_md10794}{}\doxysubsection{find\+Up.\+sync(filename, \mbox{[}options\mbox{]})}\label{md_sfcode_node_modules_find_up_readme_autotoc_md10794}
Returns a filepath or {\ttfamily null}.\hypertarget{md_sfcode_node_modules_find_up_readme_autotoc_md10795}{}\doxysubsection{find\+Up.\+sync(\mbox{[}filename\+A, filename\+B\mbox{]}, \mbox{[}options\mbox{]})}\label{md_sfcode_node_modules_find_up_readme_autotoc_md10795}
Returns the first filepath found (by respecting the order) or {\ttfamily null}.\hypertarget{md_sfcode_node_modules_find_up_readme_autotoc_md10796}{}\doxysubsubsection{filename}\label{md_sfcode_node_modules_find_up_readme_autotoc_md10796}
Type\+: {\ttfamily string}

Filename of the file to find.\hypertarget{md_sfcode_node_modules_find_up_readme_autotoc_md10797}{}\doxysubsubsection{options}\label{md_sfcode_node_modules_find_up_readme_autotoc_md10797}
Type\+: {\ttfamily Object}\hypertarget{md_sfcode_node_modules_find_up_readme_autotoc_md10798}{}\doxyparagraph{cwd}\label{md_sfcode_node_modules_find_up_readme_autotoc_md10798}
Type\+: {\ttfamily string}~\newline
 Default\+: {\ttfamily process.\+cwd()}

Directory to start from.\hypertarget{md_sfcode_node_modules_find_up_readme_autotoc_md10799}{}\doxysection{Related}\label{md_sfcode_node_modules_find_up_readme_autotoc_md10799}

\begin{DoxyItemize}
\item \href{https://github.com/sindresorhus/find-up-cli}{\texttt{ find-\/up-\/cli}} -\/ CLI for this module
\item \href{https://github.com/sindresorhus/pkg-up}{\texttt{ pkg-\/up}} -\/ Find the closest package.\+json file
\item \href{https://github.com/sindresorhus/pkg-dir}{\texttt{ pkg-\/dir}} -\/ Find the root directory of an npm package
\item \href{https://github.com/sindresorhus/resolve-from}{\texttt{ resolve-\/from}} -\/ Resolve the path of a module like {\ttfamily require.\+resolve()} but from a given path
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_find_up_readme_autotoc_md10800}{}\doxysection{License}\label{md_sfcode_node_modules_find_up_readme_autotoc_md10800}
MIT © \href{https://sindresorhus.com}{\texttt{ Sindre Sorhus}} 