1 # make-dir [![Build Status: macOS & Linux](https://travis-ci.org/sindresorhus/make-dir.svg?branch=master)](https://travis-ci.org/sindresorhus/make-dir) [![Build status: Windows](https://ci.appveyor.com/api/projects/status/e0vtt8y600w91gcs/branch/master?svg=true)](https://ci.appveyor.com/project/sindresorhus/make-dir/branch/master) [![codecov](https://codecov.io/gh/sindresorhus/make-dir/branch/master/graph/badge.svg)](https://codecov.io/gh/sindresorhus/make-dir)
3 > Make a directory and its parents if needed - Think `mkdir -p`
6 ## Advantages over [`mkdirp`](https://github.com/substack/node-mkdirp)
8 - Promise API *(Async/await ready!)*
9 - Fixes many `mkdirp` issues: [#96](https://github.com/substack/node-mkdirp/pull/96) [#70](https://github.com/substack/node-mkdirp/issues/70) [#66](https://github.com/substack/node-mkdirp/issues/66)
11 - CI-tested on macOS, Linux, and Windows
13 - Doesn't bundle a CLI
19 $ npm install make-dir
27 /Users/sindresorhus/fun
33 const makeDir = require('make-dir');
35 makeDir('unicorn/rainbow/cake').then(path => {
37 //=> '/Users/sindresorhus/fun/unicorn/rainbow/cake'
52 const makeDir = require('make-dir');
55 makeDir('unicorn/rainbow')
61 '/Users/sindresorhus/fun/unicorn/rainbow',
62 '/Users/sindresorhus/fun/foo/bar'
71 ### makeDir(path, [options])
73 Returns a `Promise` for the path to the created directory.
75 ### makeDir.sync(path, [options])
77 Returns the path to the created directory.
92 Default: `0o777 & (~process.umask())`
94 Directory [permissions](https://x-team.com/blog/file-system-permissions-umask-node-js/).
99 Default: `require('fs')`
101 Use a custom `fs` implementation. For example [`graceful-fs`](https://github.com/isaacs/node-graceful-fs).
106 - [make-dir-cli](https://github.com/sindresorhus/make-dir-cli) - CLI for this module
107 - [del](https://github.com/sindresorhus/del) - Delete files and directories
108 - [globby](https://github.com/sindresorhus/globby) - User-friendly glob matching
109 - [cpy](https://github.com/sindresorhus/cpy) - Copy files
110 - [cpy-cli](https://github.com/sindresorhus/cpy-cli) - Copy files on the command-line
111 - [move-file](https://github.com/sindresorhus/move-file) - Move a file
116 MIT © [Sindre Sorhus](https://sindresorhus.com)