\begin{quote}
User-\/friendly glob matching \end{quote}
Based on \href{https://github.com/mrmlnc/fast-glob}{\texttt{ {\ttfamily fast-\/glob}}} but adds a bunch of useful features.\hypertarget{md_sfcode_node_modules_globby_readme_autotoc_md11381}{}\doxysection{Features}\label{md_sfcode_node_modules_globby_readme_autotoc_md11381}

\begin{DoxyItemize}
\item Promise API
\item Multiple patterns
\item Negated patterns\+: `\mbox{[}\textquotesingle{}foo$\ast$', \textquotesingle{}!foobar\textquotesingle{}\mbox{]}{\ttfamily }
\item {\ttfamily Expands directories\+:}foo{\ttfamily →}foo/$\ast$$\ast$/$\ast${\ttfamily }
\item {\ttfamily Supports}.gitignore\`{}
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_globby_readme_autotoc_md11382}{}\doxysection{Install}\label{md_sfcode_node_modules_globby_readme_autotoc_md11382}

\begin{DoxyCode}{0}
\DoxyCodeLine{\$ npm install globby }

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

\begin{DoxyCode}{0}
\DoxyCodeLine{├── unicorn}
\DoxyCodeLine{├── cake}
\DoxyCodeLine{└── rainbow }

\end{DoxyCode}



\begin{DoxyCode}{0}
\DoxyCodeLine{const globby = require('globby');}
\DoxyCodeLine{}
\DoxyCodeLine{(async () => \{}
\DoxyCodeLine{    const paths = await globby(['*', '!cake']);}
\DoxyCodeLine{}
\DoxyCodeLine{    console.log(paths);}
\DoxyCodeLine{    //=> ['unicorn', 'rainbow']}
\DoxyCodeLine{\})(); }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_globby_readme_autotoc_md11384}{}\doxysection{API}\label{md_sfcode_node_modules_globby_readme_autotoc_md11384}
Note that glob patterns can only contain forward-\/slashes, not backward-\/slashes, so if you want to construct a glob pattern from path components, you need to use {\ttfamily path.\+posix.\+join()} instead of {\ttfamily path.\+join()}.\hypertarget{md_sfcode_node_modules_globby_readme_autotoc_md11385}{}\doxysubsection{globby(patterns, options?)}\label{md_sfcode_node_modules_globby_readme_autotoc_md11385}
Returns a {\ttfamily Promise$<$string\mbox{[}\mbox{]}$>$} of matching paths.\hypertarget{md_sfcode_node_modules_globby_readme_autotoc_md11386}{}\doxysubsubsection{patterns}\label{md_sfcode_node_modules_globby_readme_autotoc_md11386}
Type\+: {\ttfamily string $\vert$ string\mbox{[}\mbox{]}}

See supported {\ttfamily minimatch} \href{https://github.com/isaacs/minimatch\#usage}{\texttt{ patterns}}.\hypertarget{md_sfcode_node_modules_globby_readme_autotoc_md11387}{}\doxysubsubsection{options}\label{md_sfcode_node_modules_globby_readme_autotoc_md11387}
Type\+: {\ttfamily object}

See the \href{https://github.com/mrmlnc/fast-glob\#options-3}{\texttt{ {\ttfamily fast-\/glob} options}} in addition to the ones below.\hypertarget{md_sfcode_node_modules_globby_readme_autotoc_md11388}{}\doxyparagraph{expand\+Directories}\label{md_sfcode_node_modules_globby_readme_autotoc_md11388}
Type\+: {\ttfamily boolean $\vert$ string\mbox{[}\mbox{]} $\vert$ object}\textbackslash{} Default\+: {\ttfamily true}

If set to {\ttfamily true}, {\ttfamily globby} will automatically glob directories for you. If you define an {\ttfamily Array} it will only glob files that matches the patterns inside the {\ttfamily Array}. You can also define an {\ttfamily object} with {\ttfamily files} and {\ttfamily extensions} like below\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{const globby = require('globby');}
\DoxyCodeLine{}
\DoxyCodeLine{(async () => \{}
\DoxyCodeLine{    const paths = await globby('images', \{}
\DoxyCodeLine{        expandDirectories: \{}
\DoxyCodeLine{            files: ['cat', 'unicorn', '*.jpg'],}
\DoxyCodeLine{            extensions: ['png']}
\DoxyCodeLine{        \}}
\DoxyCodeLine{    \});}
\DoxyCodeLine{}
\DoxyCodeLine{    console.log(paths);}
\DoxyCodeLine{    //=> ['cat.png', 'unicorn.png', 'cow.jpg', 'rainbow.jpg']}
\DoxyCodeLine{\})(); }

\end{DoxyCode}


Note that if you set this option to {\ttfamily false}, you won\textquotesingle{}t get back matched directories unless you set {\ttfamily only\+Files\+: false}.\hypertarget{md_sfcode_node_modules_globby_readme_autotoc_md11389}{}\doxyparagraph{gitignore}\label{md_sfcode_node_modules_globby_readme_autotoc_md11389}
Type\+: {\ttfamily boolean}\textbackslash{} Default\+: {\ttfamily false}

Respect ignore patterns in {\ttfamily .gitignore} files that apply to the globbed files.\hypertarget{md_sfcode_node_modules_globby_readme_autotoc_md11390}{}\doxysubsection{globby.\+sync(patterns, options?)}\label{md_sfcode_node_modules_globby_readme_autotoc_md11390}
Returns {\ttfamily string\mbox{[}\mbox{]}} of matching paths.\hypertarget{md_sfcode_node_modules_globby_readme_autotoc_md11391}{}\doxysubsection{globby.\+stream(patterns, options?)}\label{md_sfcode_node_modules_globby_readme_autotoc_md11391}
Returns a \href{https://nodejs.org/api/stream.html\#stream_readable_streams}{\texttt{ {\ttfamily stream.\+Readable}}} of matching paths.

Since Node.\+js 10, \href{https://nodejs.org/api/stream.html\#stream_readable_symbol_asynciterator}{\texttt{ readable streams are iterable}}, so you can loop over glob matches in a \href{https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of}{\texttt{ {\ttfamily for await...of} loop}} like this\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{const globby = require('globby');}
\DoxyCodeLine{}
\DoxyCodeLine{(async () => \{}
\DoxyCodeLine{    for await (const path of globby.stream('*.tmp')) \{}
\DoxyCodeLine{        console.log(path);}
\DoxyCodeLine{    \}}
\DoxyCodeLine{\})(); }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_globby_readme_autotoc_md11392}{}\doxysubsection{globby.\+generate\+Glob\+Tasks(patterns, options?)}\label{md_sfcode_node_modules_globby_readme_autotoc_md11392}
Returns an {\ttfamily object\mbox{[}\mbox{]}} in the format {\ttfamily \{pattern\+: string, options\+: Object\}}, which can be passed as arguments to \href{https://github.com/mrmlnc/fast-glob}{\texttt{ {\ttfamily fast-\/glob}}}. This is useful for other globbing-\/related packages.

Note that you should avoid running the same tasks multiple times as they contain a file system cache. Instead, run this method each time to ensure file system changes are taken into consideration.\hypertarget{md_sfcode_node_modules_globby_readme_autotoc_md11393}{}\doxysubsection{globby.\+has\+Magic(patterns, options?)}\label{md_sfcode_node_modules_globby_readme_autotoc_md11393}
Returns a {\ttfamily boolean} of whether there are any special glob characters in the {\ttfamily patterns}.

Note that the options affect the results.

This function is backed by \href{https://github.com/mrmlnc/fast-glob\#isdynamicpatternpattern-options}{\texttt{ {\ttfamily fast-\/glob}}}.\hypertarget{md_sfcode_node_modules_globby_readme_autotoc_md11394}{}\doxysubsection{globby.\+gitignore(options?)}\label{md_sfcode_node_modules_globby_readme_autotoc_md11394}
Returns a {\ttfamily Promise$<$(path\+: string) =$>$ boolean$>$} indicating whether a given path is ignored via a {\ttfamily .gitignore} file.

Takes {\ttfamily cwd?\+: string} and {\ttfamily ignore?\+: string\mbox{[}\mbox{]}} as options. {\ttfamily .gitignore} files matched by the ignore config are not used for the resulting filter function.


\begin{DoxyCode}{0}
\DoxyCodeLine{const \{gitignore\} = require('globby');}
\DoxyCodeLine{}
\DoxyCodeLine{(async () => \{}
\DoxyCodeLine{    const isIgnored = await gitignore();}
\DoxyCodeLine{    console.log(isIgnored('some/file'));}
\DoxyCodeLine{\})(); }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_globby_readme_autotoc_md11395}{}\doxysubsection{globby.\+gitignore.\+sync(options?)}\label{md_sfcode_node_modules_globby_readme_autotoc_md11395}
Returns a {\ttfamily (path\+: string) =$>$ boolean} indicating whether a given path is ignored via a {\ttfamily .gitignore} file.

Takes the same options as {\ttfamily globby.\+gitignore}.\hypertarget{md_sfcode_node_modules_globby_readme_autotoc_md11396}{}\doxysection{Globbing patterns}\label{md_sfcode_node_modules_globby_readme_autotoc_md11396}
Just a quick overview.


\begin{DoxyItemize}
\item {\ttfamily $\ast$} matches any number of characters, but not {\ttfamily /}
\item {\ttfamily ?} matches a single character, but not {\ttfamily /}
\item {\ttfamily $\ast$$\ast$} matches any number of characters, including {\ttfamily /}, as long as it\textquotesingle{}s the only thing in a path part
\item {\ttfamily \{\}} allows for a comma-\/separated list of \char`\"{}or\char`\"{} expressions
\item {\ttfamily !} at the beginning of a pattern will negate the match
\end{DoxyItemize}

\href{https://github.com/sindresorhus/multimatch/blob/master/test/test.js}{\texttt{ Various patterns and expected matches.}}\hypertarget{md_sfcode_node_modules_globby_readme_autotoc_md11397}{}\doxysection{globby for enterprise}\label{md_sfcode_node_modules_globby_readme_autotoc_md11397}
Available as part of the Tidelift Subscription.

The maintainers of globby and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. \href{https://tidelift.com/subscription/pkg/npm-globby?utm_source=npm-globby&utm_medium=referral&utm_campaign=enterprise&utm_term=repo}{\texttt{ Learn more.}}\hypertarget{md_sfcode_node_modules_globby_readme_autotoc_md11398}{}\doxysection{Related}\label{md_sfcode_node_modules_globby_readme_autotoc_md11398}

\begin{DoxyItemize}
\item \href{https://github.com/sindresorhus/multimatch}{\texttt{ multimatch}} -\/ Match against a list instead of the filesystem
\item \href{https://github.com/sindresorhus/matcher}{\texttt{ matcher}} -\/ Simple wildcard matching
\item \href{https://github.com/sindresorhus/del}{\texttt{ del}} -\/ Delete files and directories
\item \href{https://github.com/sindresorhus/make-dir}{\texttt{ make-\/dir}} -\/ Make a directory and its parents if needed 
\end{DoxyItemize}