Ensures that a directory is empty. Deletes directory contents if the directory is not empty. If the directory does not exist, it is created. The directory itself is not deleted.

{\bfseries{Alias\+:}} {\ttfamily emptydir()}


\begin{DoxyItemize}
\item {\ttfamily dir} {\ttfamily $<$String$>$}
\item {\ttfamily callback} {\ttfamily $<$Function$>$}
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_fs_extra_docs_emptyDir_autotoc_md10997}{}\doxysection{Example\+:}\label{md_sfcode_node_modules_fs_extra_docs_emptyDir_autotoc_md10997}

\begin{DoxyCode}{0}
\DoxyCodeLine{const fs = require('fs-\/extra')}
\DoxyCodeLine{}
\DoxyCodeLine{// assume this directory has a lot of files and folders}
\DoxyCodeLine{fs.emptyDir('/tmp/some/dir', err => \{}
\DoxyCodeLine{  if (err) return console.error(err)}
\DoxyCodeLine{}
\DoxyCodeLine{  console.log('success!')}
\DoxyCodeLine{\})}
\DoxyCodeLine{}
\DoxyCodeLine{// With promises}
\DoxyCodeLine{fs.emptyDir('/tmp/some/dir')}
\DoxyCodeLine{.then(() => \{}
\DoxyCodeLine{  console.log('success!')}
\DoxyCodeLine{\})}
\DoxyCodeLine{.catch(err => \{}
\DoxyCodeLine{  console.error(err)}
\DoxyCodeLine{\}) }

\end{DoxyCode}
 