\href{https://travis-ci.org/npm/ignore-walk}{\texttt{ }}

Nested/recursive {\ttfamily .gitignore}/{\ttfamily .npmignore} parsing and filtering.

Walk a directory creating a list of entries, parsing any {\ttfamily .ignore} files met along the way to exclude files.\hypertarget{md_sfcode_node_modules_ignore_walk_README_autotoc_md12644}{}\doxysection{USAGE}\label{md_sfcode_node_modules_ignore_walk_README_autotoc_md12644}

\begin{DoxyCode}{0}
\DoxyCodeLine{const walk = require('ignore-\/walk')}
\DoxyCodeLine{}
\DoxyCodeLine{// All options are optional, defaults provided.}
\DoxyCodeLine{}
\DoxyCodeLine{// this function returns a promise, but you can also pass a cb}
\DoxyCodeLine{// if you like that approach better.}
\DoxyCodeLine{walk(\{}
\DoxyCodeLine{  path: '...', // root dir to start in. defaults to process.cwd()}
\DoxyCodeLine{  ignoreFiles: [ '.gitignore' ], // list of filenames. defaults to ['.ignore']}
\DoxyCodeLine{  includeEmpty: true|false, // true to include empty dirs, default false}
\DoxyCodeLine{  follow: true|false // true to follow symlink dirs, default false}
\DoxyCodeLine{\}, callback)}
\DoxyCodeLine{}
\DoxyCodeLine{// to walk synchronously, do it this way:}
\DoxyCodeLine{const result = walk.sync(\{ path: '/wow/such/filepath' \}) }

\end{DoxyCode}


If you want to get at the underlying classes, they\textquotesingle{}re at {\ttfamily walk.\+Walker} and {\ttfamily walk.\+Walker\+Sync}.\hypertarget{md_sfcode_node_modules_ignore_walk_README_autotoc_md12645}{}\doxysection{OPTIONS}\label{md_sfcode_node_modules_ignore_walk_README_autotoc_md12645}

\begin{DoxyItemize}
\item {\ttfamily path} The path to start in. Defaults to {\ttfamily process.\+cwd()}
\item {\ttfamily ignore\+Files} Filenames to treat as ignore files. The default is `\mbox{[}'.ignore\textquotesingle{}\mbox{]}{\ttfamily . (This is where you\textquotesingle{}d put}.gitignore{\ttfamily or }.npmignore\`{} or whatever.) If multiple ignore files are in a directory, then rules from each are applied in the order that the files are listed.
\item {\ttfamily include\+Empty} Set to {\ttfamily true} to include empty directories, assuming they are not excluded by any of the ignore rules. If not set, then this follows the standard {\ttfamily git} behavior of not including directories that are empty.

Note\+: this will cause an empty directory to be included if it would contain an included entry, even if it would have otherwise been excluded itself.

For example, given the rules {\ttfamily $\ast$} (ignore everything) and {\ttfamily !/a/b/c} (re-\/include the entry at {\ttfamily /a/b/c}), the directory {\ttfamily /a/b} will be included if it is empty.
\item {\ttfamily follow} Set to {\ttfamily true} to treat symbolically linked directories as directories, recursing into them. There is no handling for nested symlinks, so {\ttfamily ELOOP} errors can occur in some cases when using this option. Defaults to {\ttfamily false}. 
\end{DoxyItemize}