<div align="center">
  <img src="https://github.com/terkelg/mkdirplz/raw/master/mkdirplz.gif" alt="mkdirplz" width="35%" />
</div>

<h1 align="center">mkdir -plz</h1>

<div align="center">
  <a href="https://npmjs.org/package/mkdirplz">
    <img src="https://img.shields.io/npm/v/mkdirplz.svg" alt="version" />
  </a>
  <a href="https://travis-ci.org/terkelg/mkdirplz">
    <img src="https://img.shields.io/travis/terkelg/mkdirplz.svg" alt="travis" />
  </a>
  <a href="https://npmjs.org/package/mkdirplz">
    <img src="https://img.shields.io/npm/dm/mkdirplz.svg" alt="downloads" />
  </a>
</div>

<div align="center">Make directories recursively <b>-p</b>lease - you promised!</div>

<br />


## Installation

```
npm install mkdirplz
```

> **OBS**: This package uses async/await and requires Node.js 7.6

## Usage

```js
const mkdir = require('mkdirplz');

await mkdir('path/to/something');
// => path/to/something

await mkdir('path/to/myfile.js', { filepath: true });
// => path/to/
```

## API

This package does not create the last part of the path, since it assumes that's a filepath.

### mkdirplz(path, options)

Type: `Promise`

Creates path recursively.

#### path

Type: `String`

A string file path to create.

#### options.filepath

Type: `Boolean`<br/>
Default: `false`

Set to `true` to skip making the last segment.
Useful if the input path is a filename.



## Related
 - [mk-dirs](https://github.com/lukeed/mk-dirs) - The fast way
 - [mkdirp](https://github.com/substack/node-mkdirp) - The old school way


## License

MIT © [Terkel Gjervig](https://terkel.com)
