\begin{quote}
Make a directory and its parents if needed -\/ Think {\ttfamily mkdir -\/p} \end{quote}
\hypertarget{md_sfcode_node_modules_find_cache_dir_node_modules_make_dir_readme_autotoc_md10701}{}\doxysection{Advantages over $<$a href=\char`\"{}https\+://github.\+com/substack/node-\/mkdirp\char`\"{}$>$$<$tt$>$mkdirp$<$/tt$>$$<$/a$>$}\label{md_sfcode_node_modules_find_cache_dir_node_modules_make_dir_readme_autotoc_md10701}

\begin{DoxyItemize}
\item Promise API $\ast$(Async/await ready!)$\ast$
\item Fixes many {\ttfamily mkdirp} issues\+: \href{https://github.com/substack/node-mkdirp/pull/96}{\texttt{ \#96}} \href{https://github.com/substack/node-mkdirp/issues/70}{\texttt{ \#70}} \href{https://github.com/substack/node-mkdirp/issues/66}{\texttt{ \#66}}
\item 100\% test coverage
\item CI-\/tested on mac\+OS, Linux, and Windows
\item Actively maintained
\item Doesn\textquotesingle{}t bundle a CLI
\item Uses the native {\ttfamily fs.\+mkdir/mkdir\+Sync} \href{https://nodejs.org/dist/latest/docs/api/fs.html\#fs_fs_mkdir_path_options_callback}{\texttt{ {\ttfamily recursive} option}} in Node.\+js $>$=10.\+12.\+0 unless \href{\#fs}{\texttt{ overridden}}
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_find_cache_dir_node_modules_make_dir_readme_autotoc_md10702}{}\doxysection{Install}\label{md_sfcode_node_modules_find_cache_dir_node_modules_make_dir_readme_autotoc_md10702}

\begin{DoxyCode}{0}
\DoxyCodeLine{\$ npm install make-\/dir }

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

\begin{DoxyCode}{0}
\DoxyCodeLine{\$ pwd}
\DoxyCodeLine{/Users/sindresorhus/fun}
\DoxyCodeLine{\$ tree}
\DoxyCodeLine{. }

\end{DoxyCode}



\begin{DoxyCode}{0}
\DoxyCodeLine{const makeDir = require('make-\/dir');}
\DoxyCodeLine{}
\DoxyCodeLine{(async () => \{}
\DoxyCodeLine{    const path = await makeDir('unicorn/rainbow/cake');}
\DoxyCodeLine{}
\DoxyCodeLine{    console.log(path);}
\DoxyCodeLine{    //=> '/Users/sindresorhus/fun/unicorn/rainbow/cake'}
\DoxyCodeLine{\})(); }

\end{DoxyCode}



\begin{DoxyCode}{0}
\DoxyCodeLine{\$ tree}
\DoxyCodeLine{.}
\DoxyCodeLine{└── unicorn}
\DoxyCodeLine{    └── rainbow}
\DoxyCodeLine{        └── cake }

\end{DoxyCode}


Multiple directories\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{const makeDir = require('make-\/dir');}
\DoxyCodeLine{}
\DoxyCodeLine{(async () => \{}
\DoxyCodeLine{    const paths = await Promise.all([}
\DoxyCodeLine{        makeDir('unicorn/rainbow'),}
\DoxyCodeLine{        makeDir('foo/bar')}
\DoxyCodeLine{    ]);}
\DoxyCodeLine{}
\DoxyCodeLine{    console.log(paths);}
\DoxyCodeLine{    /*}
\DoxyCodeLine{    [}
\DoxyCodeLine{        '/Users/sindresorhus/fun/unicorn/rainbow',}
\DoxyCodeLine{        '/Users/sindresorhus/fun/foo/bar'}
\DoxyCodeLine{    ]}
\DoxyCodeLine{    */}
\DoxyCodeLine{\})(); }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_find_cache_dir_node_modules_make_dir_readme_autotoc_md10704}{}\doxysection{API}\label{md_sfcode_node_modules_find_cache_dir_node_modules_make_dir_readme_autotoc_md10704}
\hypertarget{md_sfcode_node_modules_find_cache_dir_node_modules_make_dir_readme_autotoc_md10705}{}\doxysubsection{make\+Dir(path, options?)}\label{md_sfcode_node_modules_find_cache_dir_node_modules_make_dir_readme_autotoc_md10705}
Returns a {\ttfamily Promise} for the path to the created directory.\hypertarget{md_sfcode_node_modules_find_cache_dir_node_modules_make_dir_readme_autotoc_md10706}{}\doxysubsection{make\+Dir.\+sync(path, options?)}\label{md_sfcode_node_modules_find_cache_dir_node_modules_make_dir_readme_autotoc_md10706}
Returns the path to the created directory.\hypertarget{md_sfcode_node_modules_find_cache_dir_node_modules_make_dir_readme_autotoc_md10707}{}\doxysubsubsection{path}\label{md_sfcode_node_modules_find_cache_dir_node_modules_make_dir_readme_autotoc_md10707}
Type\+: {\ttfamily string}

Directory to create.\hypertarget{md_sfcode_node_modules_find_cache_dir_node_modules_make_dir_readme_autotoc_md10708}{}\doxysubsubsection{options}\label{md_sfcode_node_modules_find_cache_dir_node_modules_make_dir_readme_autotoc_md10708}
Type\+: {\ttfamily object}\hypertarget{md_sfcode_node_modules_find_cache_dir_node_modules_make_dir_readme_autotoc_md10709}{}\doxyparagraph{mode}\label{md_sfcode_node_modules_find_cache_dir_node_modules_make_dir_readme_autotoc_md10709}
Type\+: {\ttfamily integer}\textbackslash{} Default\+: {\ttfamily 0o777}

Directory \href{https://x-team.com/blog/file-system-permissions-umask-node-js/}{\texttt{ permissions}}.\hypertarget{md_sfcode_node_modules_find_cache_dir_node_modules_make_dir_readme_autotoc_md10710}{}\doxyparagraph{fs}\label{md_sfcode_node_modules_find_cache_dir_node_modules_make_dir_readme_autotoc_md10710}
Type\+: {\ttfamily object}\textbackslash{} Default\+: `require(\textquotesingle{}fs')\`{}

Use a custom {\ttfamily fs} implementation. For example \href{https://github.com/isaacs/node-graceful-fs}{\texttt{ {\ttfamily graceful-\/fs}}}.

Using a custom {\ttfamily fs} implementation will block the use of the native {\ttfamily recursive} option if {\ttfamily fs.\+mkdir} or {\ttfamily fs.\+mkdir\+Sync} is not the native function.\hypertarget{md_sfcode_node_modules_find_cache_dir_node_modules_make_dir_readme_autotoc_md10711}{}\doxysection{Related}\label{md_sfcode_node_modules_find_cache_dir_node_modules_make_dir_readme_autotoc_md10711}

\begin{DoxyItemize}
\item \href{https://github.com/sindresorhus/make-dir-cli}{\texttt{ make-\/dir-\/cli}} -\/ CLI for this module
\item \href{https://github.com/sindresorhus/del}{\texttt{ del}} -\/ Delete files and directories
\item \href{https://github.com/sindresorhus/globby}{\texttt{ globby}} -\/ User-\/friendly glob matching
\item \href{https://github.com/sindresorhus/cpy}{\texttt{ cpy}} -\/ Copy files
\item \href{https://github.com/sindresorhus/cpy-cli}{\texttt{ cpy-\/cli}} -\/ Copy files on the command-\/line
\item \href{https://github.com/sindresorhus/move-file}{\texttt{ move-\/file}} -\/ Move a file
\end{DoxyItemize}

\DoxyHorRuler{0}


 {\bfseries{ \href{https://tidelift.com/subscription/pkg/npm-make-dir?utm_source=npm-make-dir&utm_medium=referral&utm_campaign=readme}{\texttt{ Get professional support for this package with a Tidelift subscription}} }} ~\newline
 \textsubscript{ Tidelift helps make open source sustainable for maintainers while giving companies~\newline
assurances about security, maintenance, and licensing for their dependencies. }  