Ensures that the directory exists. If the directory structure does not exist, it is created. Like {\ttfamily mkdir -\/p}.

{\bfseries{Aliases\+:}} {\ttfamily mkdirs()}, {\ttfamily mkdirp()}


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

\begin{DoxyCode}{0}
\DoxyCodeLine{const fs = require('fs-\/extra')}
\DoxyCodeLine{}
\DoxyCodeLine{const dir = '/tmp/this/path/does/not/exist'}
\DoxyCodeLine{fs.ensureDir(dir, err => \{}
\DoxyCodeLine{  console.log(err) // => null}
\DoxyCodeLine{  // dir has now been created, including the directory it is to be placed in}
\DoxyCodeLine{\})}
\DoxyCodeLine{}
\DoxyCodeLine{// With Promises:}
\DoxyCodeLine{fs.ensureDir(dir)}
\DoxyCodeLine{.then(() => \{}
\DoxyCodeLine{  console.log('success!')}
\DoxyCodeLine{\})}
\DoxyCodeLine{.catch(err => \{}
\DoxyCodeLine{  console.error(err)}
\DoxyCodeLine{\}) }

\end{DoxyCode}
 