\begin{quote}
A library for efficiently walking a directory recursively. \end{quote}
\hypertarget{md_sfcode_node_modules__nodelib_fs_walk_README_autotoc_md2072}{}\doxysection{\+:bulb\+: Highlights}\label{md_sfcode_node_modules__nodelib_fs_walk_README_autotoc_md2072}

\begin{DoxyItemize}
\item \+:moneybag\+: Returns useful information\+: {\ttfamily name}, {\ttfamily path}, {\ttfamily dirent} and {\ttfamily stats} (optional).
\item \+:rocket\+: On Node.\+js 10.\+10+ uses the mechanism without additional calls to determine the entry type for performance reasons. See \href{https://github.com/nodelib/nodelib/blob/master/packages/fs/fs.scandir/README.md\#old-and-modern-mode}{\texttt{ {\ttfamily old} and {\ttfamily modern} mode}}.
\item \+:gear\+: Built-\/in directories/files and error filtering system.
\item \+:link\+: Can safely work with broken symbolic links.
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules__nodelib_fs_walk_README_autotoc_md2073}{}\doxysection{Install}\label{md_sfcode_node_modules__nodelib_fs_walk_README_autotoc_md2073}

\begin{DoxyCode}{0}
\DoxyCodeLine{npm install @nodelib/fs.walk }

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

\begin{DoxyCode}{0}
\DoxyCodeLine{import * as fsWalk from '@nodelib/fs.walk';}
\DoxyCodeLine{}
\DoxyCodeLine{fsWalk.walk('path', (error, entries) => \{ /* … */ \}); }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules__nodelib_fs_walk_README_autotoc_md2075}{}\doxysection{API}\label{md_sfcode_node_modules__nodelib_fs_walk_README_autotoc_md2075}
\hypertarget{md_sfcode_node_modules__nodelib_fs_walk_README_autotoc_md2076}{}\doxysubsection{.\+walk(path, \mbox{[}options\+Or\+Settings\mbox{]}, callback)}\label{md_sfcode_node_modules__nodelib_fs_walk_README_autotoc_md2076}
Reads the directory recursively and asynchronously. Requires a callback function.

\begin{quote}
\+:book\+: If you want to use the Promise API, use {\ttfamily util.\+promisify}. \end{quote}

\begin{DoxyCode}{0}
\DoxyCodeLine{fsWalk.walk('path', (error, entries) => \{ /* … */ \});}
\DoxyCodeLine{fsWalk.walk('path', \{\}, (error, entries) => \{ /* … */ \});}
\DoxyCodeLine{fsWalk.walk('path', new fsWalk.Settings(), (error, entries) => \{ /* … */ \}); }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules__nodelib_fs_walk_README_autotoc_md2077}{}\doxysubsection{.\+walk\+Stream(path, \mbox{[}options\+Or\+Settings\mbox{]})}\label{md_sfcode_node_modules__nodelib_fs_walk_README_autotoc_md2077}
Reads the directory recursively and asynchronously. \href{https://nodejs.org/dist/latest-v12.x/docs/api/stream.html\#stream_readable_streams}{\texttt{ Readable Stream}} is used as a provider.


\begin{DoxyCode}{0}
\DoxyCodeLine{const stream = fsWalk.walkStream('path');}
\DoxyCodeLine{const stream = fsWalk.walkStream('path', \{\});}
\DoxyCodeLine{const stream = fsWalk.walkStream('path', new fsWalk.Settings()); }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules__nodelib_fs_walk_README_autotoc_md2078}{}\doxysubsection{.\+walk\+Sync(path, \mbox{[}options\+Or\+Settings\mbox{]})}\label{md_sfcode_node_modules__nodelib_fs_walk_README_autotoc_md2078}
Reads the directory recursively and synchronously. Returns an array of entries.


\begin{DoxyCode}{0}
\DoxyCodeLine{const entries = fsWalk.walkSync('path');}
\DoxyCodeLine{const entries = fsWalk.walkSync('path', \{\});}
\DoxyCodeLine{const entries = fsWalk.walkSync('path', new fsWalk.Settings()); }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules__nodelib_fs_walk_README_autotoc_md2079}{}\doxysubsubsection{path}\label{md_sfcode_node_modules__nodelib_fs_walk_README_autotoc_md2079}

\begin{DoxyItemize}
\item Required\+: {\ttfamily true}
\item Type\+: {\ttfamily string $\vert$ Buffer $\vert$ URL}
\end{DoxyItemize}

A path to a file. If a URL is provided, it must use the {\ttfamily file\+:} protocol.\hypertarget{md_sfcode_node_modules__nodelib_fs_walk_README_autotoc_md2080}{}\doxysubsubsection{options\+Or\+Settings}\label{md_sfcode_node_modules__nodelib_fs_walk_README_autotoc_md2080}

\begin{DoxyItemize}
\item Required\+: {\ttfamily false}
\item Type\+: {\ttfamily Options $\vert$ Settings}
\item Default\+: An instance of {\ttfamily Settings} class
\end{DoxyItemize}

An \href{\#options}{\texttt{ {\ttfamily Options}}} object or an instance of \href{\#settings}{\texttt{ {\ttfamily Settings}}} class.

\begin{quote}
\+:book\+: When you pass a plain object, an instance of the {\ttfamily Settings} class will be created automatically. If you plan to call the method frequently, use a pre-\/created instance of the {\ttfamily Settings} class. \end{quote}
\hypertarget{md_sfcode_node_modules__nodelib_fs_walk_README_autotoc_md2081}{}\doxysubsection{Settings(\mbox{[}options\mbox{]})}\label{md_sfcode_node_modules__nodelib_fs_walk_README_autotoc_md2081}
A class of full settings of the package.


\begin{DoxyCode}{0}
\DoxyCodeLine{const settings = new fsWalk.Settings(\{ followSymbolicLinks: true \});}
\DoxyCodeLine{}
\DoxyCodeLine{const entries = fsWalk.walkSync('path', settings); }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules__nodelib_fs_walk_README_autotoc_md2082}{}\doxysection{Entry}\label{md_sfcode_node_modules__nodelib_fs_walk_README_autotoc_md2082}

\begin{DoxyItemize}
\item {\ttfamily name} — The name of the entry ({\ttfamily unknown.\+txt}).
\item {\ttfamily path} — The path of the entry relative to call directory ({\ttfamily root/unknown.\+txt}).
\item {\ttfamily dirent} — An instance of \href{./src/types/index.ts}{\texttt{ {\ttfamily fs.\+Dirent}}} class.
\item \mbox{[}{\ttfamily stats}\mbox{]} — An instance of {\ttfamily fs.\+Stats} class.
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules__nodelib_fs_walk_README_autotoc_md2083}{}\doxysection{Options}\label{md_sfcode_node_modules__nodelib_fs_walk_README_autotoc_md2083}
\hypertarget{md_sfcode_node_modules__nodelib_fs_walk_README_autotoc_md2084}{}\doxysubsection{base\+Path}\label{md_sfcode_node_modules__nodelib_fs_walk_README_autotoc_md2084}

\begin{DoxyItemize}
\item Type\+: {\ttfamily string}
\item Default\+: {\ttfamily undefined}
\end{DoxyItemize}

By default, all paths are built relative to the root path. You can use this option to set custom root path.

In the example below we read the files from the {\ttfamily root} directory, but in the results the root path will be {\ttfamily custom}.


\begin{DoxyCode}{0}
\DoxyCodeLine{fsWalk.walkSync('root'); // → ['root/file.txt']}
\DoxyCodeLine{fsWalk.walkSync('root', \{ basePath: 'custom' \}); // → ['custom/file.txt'] }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules__nodelib_fs_walk_README_autotoc_md2085}{}\doxysubsection{concurrency}\label{md_sfcode_node_modules__nodelib_fs_walk_README_autotoc_md2085}

\begin{DoxyItemize}
\item Type\+: {\ttfamily number}
\item Default\+: {\ttfamily Infinity}
\end{DoxyItemize}

The maximum number of concurrent calls to {\ttfamily fs.\+readdir}.

\begin{quote}
\+:book\+: The higher the number, the higher performance and the load on the File System. If you want to read in quiet mode, set the value to {\ttfamily 4 $\ast$ os.\+cpus().length} (4 is default size of \href{http://docs.libuv.org/en/v1.x/threadpool.html\#thread-pool-work-scheduling}{\texttt{ thread pool work scheduling}}). \end{quote}
\hypertarget{md_sfcode_node_modules__nodelib_fs_walk_README_autotoc_md2086}{}\doxysubsection{deep\+Filter}\label{md_sfcode_node_modules__nodelib_fs_walk_README_autotoc_md2086}

\begin{DoxyItemize}
\item Type\+: \href{./src/settings.ts}{\texttt{ {\ttfamily Deep\+Filter\+Function}}}
\item Default\+: {\ttfamily undefined}
\end{DoxyItemize}

A function that indicates whether the directory will be read deep or not.


\begin{DoxyCode}{0}
\DoxyCodeLine{// Skip all directories that starts with `node\_modules`}
\DoxyCodeLine{const filter: DeepFilterFunction = (entry) => !entry.path.startsWith('node\_modules'); }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules__nodelib_fs_walk_README_autotoc_md2087}{}\doxysubsection{entry\+Filter}\label{md_sfcode_node_modules__nodelib_fs_walk_README_autotoc_md2087}

\begin{DoxyItemize}
\item Type\+: \href{./src/settings.ts}{\texttt{ {\ttfamily Entry\+Filter\+Function}}}
\item Default\+: {\ttfamily undefined}
\end{DoxyItemize}

A function that indicates whether the entry will be included to results or not.


\begin{DoxyCode}{0}
\DoxyCodeLine{// Exclude all `.js` files from results}
\DoxyCodeLine{const filter: EntryFilterFunction = (entry) => !entry.name.endsWith('.js'); }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules__nodelib_fs_walk_README_autotoc_md2088}{}\doxysubsection{error\+Filter}\label{md_sfcode_node_modules__nodelib_fs_walk_README_autotoc_md2088}

\begin{DoxyItemize}
\item Type\+: \href{./src/settings.ts}{\texttt{ {\ttfamily Error\+Filter\+Function}}}
\item Default\+: {\ttfamily undefined}
\end{DoxyItemize}

A function that allows you to skip errors that occur when reading directories.

For example, you can skip {\ttfamily ENOENT} errors if required\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{// Skip all ENOENT errors}
\DoxyCodeLine{const filter: ErrorFilterFunction = (error) => error.code == 'ENOENT'; }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules__nodelib_fs_walk_README_autotoc_md2089}{}\doxysubsection{stats}\label{md_sfcode_node_modules__nodelib_fs_walk_README_autotoc_md2089}

\begin{DoxyItemize}
\item Type\+: {\ttfamily boolean}
\item Default\+: {\ttfamily false}
\end{DoxyItemize}

Adds an instance of {\ttfamily fs.\+Stats} class to the \href{\#entry}{\texttt{ {\ttfamily Entry}}}.

\begin{quote}
\+:book\+: Always use {\ttfamily fs.\+readdir} with additional {\ttfamily fs.\+lstat/fs.stat} calls to determine the entry type. \end{quote}
\hypertarget{md_sfcode_node_modules__nodelib_fs_walk_README_autotoc_md2090}{}\doxysubsection{follow\+Symbolic\+Links}\label{md_sfcode_node_modules__nodelib_fs_walk_README_autotoc_md2090}

\begin{DoxyItemize}
\item Type\+: {\ttfamily boolean}
\item Default\+: {\ttfamily false}
\end{DoxyItemize}

Follow symbolic links or not. Call {\ttfamily fs.\+stat} on symbolic link if {\ttfamily true}.\hypertarget{md_sfcode_node_modules__nodelib_fs_walk_README_autotoc_md2091}{}\doxysubsection{$<$tt$>$throw\+Error\+On\+Broken\+Symbolic\+Link$<$/tt$>$}\label{md_sfcode_node_modules__nodelib_fs_walk_README_autotoc_md2091}

\begin{DoxyItemize}
\item Type\+: {\ttfamily boolean}
\item Default\+: {\ttfamily true}
\end{DoxyItemize}

Throw an error when symbolic link is broken if {\ttfamily true} or safely return {\ttfamily lstat} call if {\ttfamily false}.\hypertarget{md_sfcode_node_modules__nodelib_fs_walk_README_autotoc_md2092}{}\doxysubsection{$<$tt$>$path\+Segment\+Separator$<$/tt$>$}\label{md_sfcode_node_modules__nodelib_fs_walk_README_autotoc_md2092}

\begin{DoxyItemize}
\item Type\+: {\ttfamily string}
\item Default\+: {\ttfamily path.\+sep}
\end{DoxyItemize}

By default, this package uses the correct path separator for your OS ({\ttfamily \textbackslash{}} on Windows, {\ttfamily /} on Unix-\/like systems). But you can set this option to any separator character(s) that you want to use instead.\hypertarget{md_sfcode_node_modules__nodelib_fs_walk_README_autotoc_md2093}{}\doxysubsection{$<$tt$>$fs$<$/tt$>$}\label{md_sfcode_node_modules__nodelib_fs_walk_README_autotoc_md2093}

\begin{DoxyItemize}
\item Type\+: {\ttfamily File\+System\+Adapter}
\item Default\+: A default FS methods
\end{DoxyItemize}

By default, the built-\/in Node.\+js module ({\ttfamily fs}) is used to work with the file system. You can replace any method with your own.


\begin{DoxyCode}{0}
\DoxyCodeLine{interface FileSystemAdapter \{}
\DoxyCodeLine{    lstat: typeof fs.lstat;}
\DoxyCodeLine{    stat: typeof fs.stat;}
\DoxyCodeLine{    lstatSync: typeof fs.lstatSync;}
\DoxyCodeLine{    statSync: typeof fs.statSync;}
\DoxyCodeLine{    readdir: typeof fs.readdir;}
\DoxyCodeLine{    readdirSync: typeof fs.readdirSync;}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{const settings = new fsWalk.Settings(\{}
\DoxyCodeLine{    fs: \{ lstat: fakeLstat \}}
\DoxyCodeLine{\}); }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules__nodelib_fs_walk_README_autotoc_md2094}{}\doxysection{Changelog}\label{md_sfcode_node_modules__nodelib_fs_walk_README_autotoc_md2094}
See the \href{https://github.com/nodelib/nodelib/releases}{\texttt{ Releases section of our Git\+Hub project}} for changelog for each release version.\hypertarget{md_sfcode_node_modules__nodelib_fs_walk_README_autotoc_md2095}{}\doxysection{License}\label{md_sfcode_node_modules__nodelib_fs_walk_README_autotoc_md2095}
This software is released under the terms of the MIT license. 