\href{https://travis-ci.org/isaacs/rimraf}{\texttt{ }} \href{https://david-dm.org/isaacs/rimraf}{\texttt{ }} \href{https://david-dm.org/isaacs/rimraf\#info=devDependencies}{\texttt{ }}

The \href{http://en.wikipedia.org/wiki/Rm_(Unix)}{\texttt{ UNIX command}} {\ttfamily rm -\/rf} for node.

Install with {\ttfamily npm install rimraf}, or just drop rimraf.\+js somewhere.\hypertarget{md_sfcode_node_modules_rimraf_README_autotoc_md24945}{}\doxysubsection{API}\label{md_sfcode_node_modules_rimraf_README_autotoc_md24945}
{\ttfamily rimraf(f, \mbox{[}opts\mbox{]}, callback)}

The first parameter will be interpreted as a globbing pattern for files. If you want to disable globbing you can do so with {\ttfamily opts.\+disable\+Glob} (defaults to {\ttfamily false}). This might be handy, for instance, if you have filenames that contain globbing wildcard characters.

The callback will be called with an error if there is one. Certain errors are handled for you\+:


\begin{DoxyItemize}
\item Windows\+: {\ttfamily EBUSY} and {\ttfamily ENOTEMPTY} -\/ rimraf will back off a maximum of {\ttfamily opts.\+max\+Busy\+Tries} times before giving up, adding 100ms of wait between each attempt. The default {\ttfamily max\+Busy\+Tries} is 3.
\item {\ttfamily ENOENT} -\/ If the file doesn\textquotesingle{}t exist, rimraf will return successfully, since your desired outcome is already the case.
\item {\ttfamily EMFILE} -\/ Since {\ttfamily readdir} requires opening a file descriptor, it\textquotesingle{}s possible to hit {\ttfamily EMFILE} if too many file descriptors are in use. In the sync case, there\textquotesingle{}s nothing to be done for this. But in the async case, rimraf will gradually back off with timeouts up to {\ttfamily opts.\+emfile\+Wait} ms, which defaults to 1000.
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_rimraf_README_autotoc_md24946}{}\doxysubsection{options}\label{md_sfcode_node_modules_rimraf_README_autotoc_md24946}

\begin{DoxyItemize}
\item unlink, chmod, stat, lstat, rmdir, readdir, unlink\+Sync, chmod\+Sync, stat\+Sync, lstat\+Sync, rmdir\+Sync, readdir\+Sync

In order to use a custom file system library, you can override specific fs functions on the options object.

If any of these functions are present on the options object, then the supplied function will be used instead of the default fs method.

Sync methods are only relevant for {\ttfamily rimraf.\+sync()}, of course.

For example\+:

\`{}\`{}`javascript var my\+Custom\+FS = require(\textquotesingle{}some-\/custom-\/fs')

rimraf(\textquotesingle{}some-\/thing\textquotesingle{}, my\+Custom\+FS, callback) \`{}\`{}\`{}
\item max\+Busy\+Tries

If an {\ttfamily EBUSY}, {\ttfamily ENOTEMPTY}, or {\ttfamily EPERM} error code is encountered on Windows systems, then rimraf will retry with a linear backoff wait of 100ms longer on each try. The default max\+Busy\+Tries is 3.

Only relevant for async usage.
\item emfile\+Wait

If an {\ttfamily EMFILE} error is encountered, then rimraf will retry repeatedly with a linear backoff of 1ms longer on each try, until the timeout counter hits this max. The default limit is 1000.

If you repeatedly encounter {\ttfamily EMFILE} errors, then consider using \href{http://npm.im/graceful-fs}{\texttt{ graceful-\/fs}} in your program.

Only relevant for async usage.
\item glob

Set to {\ttfamily false} to disable \href{http://npm.im/glob}{\texttt{ glob}} pattern matching.

Set to an object to pass options to the glob module. The default glob options are {\ttfamily \{ nosort\+: true, silent\+: true \}}.

Glob version 6 is used in this module.

Relevant for both sync and async usage.
\item disable\+Glob

Set to any non-\/falsey value to disable globbing entirely. (Equivalent to setting {\ttfamily glob\+: false}.)
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_rimraf_README_autotoc_md24947}{}\doxysubsection{rimraf.\+sync}\label{md_sfcode_node_modules_rimraf_README_autotoc_md24947}
It can remove stuff synchronously, too. But that\textquotesingle{}s not so good. Use the async API. It\textquotesingle{}s better.\hypertarget{md_sfcode_node_modules_rimraf_README_autotoc_md24948}{}\doxysubsection{CLI}\label{md_sfcode_node_modules_rimraf_README_autotoc_md24948}
If installed with {\ttfamily npm install rimraf -\/g} it can be used as a global command {\ttfamily rimraf $<$path$>$ \mbox{[}$<$path$>$ ...\mbox{]}} which is useful for cross platform support.\hypertarget{md_sfcode_node_modules_rimraf_README_autotoc_md24949}{}\doxysubsection{mkdirp}\label{md_sfcode_node_modules_rimraf_README_autotoc_md24949}
If you need to create a directory recursively, check out \href{https://github.com/substack/node-mkdirp}{\texttt{ mkdirp}}. 