Like {\ttfamily mkdir -\/p}, but in node.\+js!

\href{http://travis-ci.org/substack/node-mkdirp}{\texttt{ }}\hypertarget{md_sfcode_node_modules_mkdirp_readme_autotoc_md17731}{}\doxysection{example}\label{md_sfcode_node_modules_mkdirp_readme_autotoc_md17731}
\hypertarget{md_sfcode_node_modules_mkdirp_readme_autotoc_md17732}{}\doxysubsection{pow.\+js}\label{md_sfcode_node_modules_mkdirp_readme_autotoc_md17732}

\begin{DoxyCode}{0}
\DoxyCodeLine{var mkdirp = require('mkdirp');}
\DoxyCodeLine{    }
\DoxyCodeLine{mkdirp('/tmp/foo/bar/baz', function (err) \{}
\DoxyCodeLine{    if (err) console.error(err)}
\DoxyCodeLine{    else console.log('pow!')}
\DoxyCodeLine{\}); }

\end{DoxyCode}


Output


\begin{DoxyCode}{0}
\DoxyCodeLine{pow! }

\end{DoxyCode}


And now /tmp/foo/bar/baz exists, huzzah!\hypertarget{md_sfcode_node_modules_mkdirp_readme_autotoc_md17733}{}\doxysection{methods}\label{md_sfcode_node_modules_mkdirp_readme_autotoc_md17733}

\begin{DoxyCode}{0}
\DoxyCodeLine{var mkdirp = require('mkdirp'); }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_mkdirp_readme_autotoc_md17734}{}\doxysubsection{mkdirp(dir, opts, cb)}\label{md_sfcode_node_modules_mkdirp_readme_autotoc_md17734}
Create a new directory and any necessary subdirectories at {\ttfamily dir} with octal permission string {\ttfamily opts.\+mode}. If {\ttfamily opts} is a non-\/object, it will be treated as the {\ttfamily opts.\+mode}.

If {\ttfamily opts.\+mode} isn\textquotesingle{}t specified, it defaults to {\ttfamily 0777}.

{\ttfamily cb(err, made)} fires with the error or the first directory {\ttfamily made} that had to be created, if any.

You can optionally pass in an alternate {\ttfamily fs} implementation by passing in {\ttfamily opts.\+fs}. Your implementation should have {\ttfamily opts.\+fs.\+mkdir(path, mode, cb)} and {\ttfamily opts.\+fs.\+stat(path, cb)}.\hypertarget{md_sfcode_node_modules_mkdirp_readme_autotoc_md17735}{}\doxysubsection{mkdirp.\+sync(dir, opts)}\label{md_sfcode_node_modules_mkdirp_readme_autotoc_md17735}
Synchronously create a new directory and any necessary subdirectories at {\ttfamily dir} with octal permission string {\ttfamily opts.\+mode}. If {\ttfamily opts} is a non-\/object, it will be treated as the {\ttfamily opts.\+mode}.

If {\ttfamily opts.\+mode} isn\textquotesingle{}t specified, it defaults to {\ttfamily 0777}.

Returns the first directory that had to be created, if any.

You can optionally pass in an alternate {\ttfamily fs} implementation by passing in {\ttfamily opts.\+fs}. Your implementation should have {\ttfamily opts.\+fs.\+mkdir\+Sync(path, mode)} and {\ttfamily opts.\+fs.\+stat\+Sync(path)}.\hypertarget{md_sfcode_node_modules_mkdirp_readme_autotoc_md17736}{}\doxysection{usage}\label{md_sfcode_node_modules_mkdirp_readme_autotoc_md17736}
This package also ships with a {\ttfamily mkdirp} command.


\begin{DoxyCode}{0}
\DoxyCodeLine{usage: mkdirp [DIR1,DIR2..] \{OPTIONS\}}
\DoxyCodeLine{}
\DoxyCodeLine{  Create each supplied directory including any necessary parent directories that}
\DoxyCodeLine{  don't yet exist.}
\DoxyCodeLine{  }
\DoxyCodeLine{  If the directory already exists, do nothing.}
\DoxyCodeLine{}
\DoxyCodeLine{OPTIONS are:}
\DoxyCodeLine{}
\DoxyCodeLine{  -\/m, -\/-\/mode   If a directory needs to be created, set the mode as an octal}
\DoxyCodeLine{               permission string.}

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_mkdirp_readme_autotoc_md17737}{}\doxysection{install}\label{md_sfcode_node_modules_mkdirp_readme_autotoc_md17737}
With \href{http://npmjs.org}{\texttt{ npm}} do\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{npm install mkdirp }

\end{DoxyCode}


to get the library, or


\begin{DoxyCode}{0}
\DoxyCodeLine{npm install -\/g mkdirp }

\end{DoxyCode}


to get the command.\hypertarget{md_sfcode_node_modules_mkdirp_readme_autotoc_md17738}{}\doxysection{license}\label{md_sfcode_node_modules_mkdirp_readme_autotoc_md17738}
MIT 