\begin{quote}
Delete files and folders using \href{https://github.com/isaacs/minimatch\#usage}{\texttt{ globs}} \end{quote}
Pretty much \href{https://github.com/isaacs/rimraf}{\texttt{ rimraf}} with a Promise API and support for multiple files and globbing. It also protects you against deleting the current working directory and above.

\DoxyHorRuler{0}




{\bfseries{🔥 Want to strengthen your core Java\+Script skills and master ES6?}}~\newline
I would personally recommend this awesome \href{https://ES6.io/friend/AWESOME}{\texttt{ ES6 course}} by Wes Bos.

\DoxyHorRuler{0}
\hypertarget{md_sfcode_node_modules_protractor_node_modules_del_readme_autotoc_md22739}{}\doxysection{Install}\label{md_sfcode_node_modules_protractor_node_modules_del_readme_autotoc_md22739}

\begin{DoxyCode}{0}
\DoxyCodeLine{\$ npm install -\/-\/save del }

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

\begin{DoxyCode}{0}
\DoxyCodeLine{const del = require('del');}
\DoxyCodeLine{}
\DoxyCodeLine{del(['tmp/*.js', '!tmp/unicorn.js']).then(paths => \{}
\DoxyCodeLine{    console.log('Deleted files and folders:\(\backslash\)n', paths.join('\(\backslash\)n'));}
\DoxyCodeLine{\}); }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_protractor_node_modules_del_readme_autotoc_md22741}{}\doxysection{Beware}\label{md_sfcode_node_modules_protractor_node_modules_del_readme_autotoc_md22741}
The glob pattern {\ttfamily $\ast$$\ast$} matches all children and {\itshape the parent}.

So this won\textquotesingle{}t work\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{del.sync(['public/assets/**', '!public/assets/goat.png']); }

\end{DoxyCode}


You have to explicitly ignore the parent directories too\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{del.sync(['public/assets/**', '!public/assets', '!public/assets/goat.png']); }

\end{DoxyCode}


Suggestions on how to improve this welcome!\hypertarget{md_sfcode_node_modules_protractor_node_modules_del_readme_autotoc_md22742}{}\doxysection{API}\label{md_sfcode_node_modules_protractor_node_modules_del_readme_autotoc_md22742}
\hypertarget{md_sfcode_node_modules_protractor_node_modules_del_readme_autotoc_md22743}{}\doxysubsection{del(patterns, \mbox{[}options\mbox{]})}\label{md_sfcode_node_modules_protractor_node_modules_del_readme_autotoc_md22743}
Returns a promise for an array of deleted paths.\hypertarget{md_sfcode_node_modules_protractor_node_modules_del_readme_autotoc_md22744}{}\doxysubsection{del.\+sync(patterns, \mbox{[}options\mbox{]})}\label{md_sfcode_node_modules_protractor_node_modules_del_readme_autotoc_md22744}
Returns an array of deleted paths.\hypertarget{md_sfcode_node_modules_protractor_node_modules_del_readme_autotoc_md22745}{}\doxysubsubsection{patterns}\label{md_sfcode_node_modules_protractor_node_modules_del_readme_autotoc_md22745}
Type\+: {\ttfamily string}, {\ttfamily array}

See supported minimatch \href{https://github.com/isaacs/minimatch\#usage}{\texttt{ patterns}}.


\begin{DoxyItemize}
\item \href{https://github.com/sindresorhus/multimatch/blob/master/test.js}{\texttt{ Pattern examples with expected matches}}
\item \href{https://github.com/sindresorhus/multimatch\#globbing-patterns}{\texttt{ Quick globbing pattern overview}}
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_protractor_node_modules_del_readme_autotoc_md22746}{}\doxysubsubsection{options}\label{md_sfcode_node_modules_protractor_node_modules_del_readme_autotoc_md22746}
Type\+: {\ttfamily object}

See the {\ttfamily node-\/glob} \href{https://github.com/isaacs/node-glob\#options}{\texttt{ options}}.\hypertarget{md_sfcode_node_modules_protractor_node_modules_del_readme_autotoc_md22747}{}\doxyparagraph{force}\label{md_sfcode_node_modules_protractor_node_modules_del_readme_autotoc_md22747}
Type\+: {\ttfamily boolean} ~\newline
 Default\+: {\ttfamily false}

Allow deleting the current working directory and outside.\hypertarget{md_sfcode_node_modules_protractor_node_modules_del_readme_autotoc_md22748}{}\doxyparagraph{dry\+Run}\label{md_sfcode_node_modules_protractor_node_modules_del_readme_autotoc_md22748}
Type\+: {\ttfamily boolean} ~\newline
 Default\+: {\ttfamily false}

See what would be deleted.


\begin{DoxyCode}{0}
\DoxyCodeLine{const del = require('del');}
\DoxyCodeLine{}
\DoxyCodeLine{del(['tmp/*.js'], \{dryRun: true\}).then(paths => \{}
\DoxyCodeLine{    console.log('Files and folders that would be deleted:\(\backslash\)n', paths.join('\(\backslash\)n'));}
\DoxyCodeLine{\}); }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_protractor_node_modules_del_readme_autotoc_md22749}{}\doxysection{CLI}\label{md_sfcode_node_modules_protractor_node_modules_del_readme_autotoc_md22749}
See \href{https://github.com/sindresorhus/del-cli}{\texttt{ del-\/cli}} for a CLI for this module and \href{https://github.com/sindresorhus/trash-cli}{\texttt{ trash-\/cli}} for a safe version that is suitable for running by hand.\hypertarget{md_sfcode_node_modules_protractor_node_modules_del_readme_autotoc_md22750}{}\doxysection{License}\label{md_sfcode_node_modules_protractor_node_modules_del_readme_autotoc_md22750}
MIT © \href{http://sindresorhus.com}{\texttt{ Sindre Sorhus}} 