# async-mkdirp

> Recursively create directories, like `mkdir -p`, and return a promise.

Latest version **1.2.7** (published 2018-11-02) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install async-mkdirp
pnpm add async-mkdirp
yarn add async-mkdirp
bun add async-mkdirp
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.2.7 |
| Published | 2018-11-02 |
| First published | 2017-03-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 3.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Simon Laroche |
| Maintainers | simonlc |
| Keywords | mkdir, async, directory |

## Links

- npm: https://www.npmjs.com/package/async-mkdirp
- Repository: https://github.com/simonlc/async-mkdirp
- Homepage: https://github.com/simonlc/async-mkdirp#readme
- Issues: https://github.com/simonlc/async-mkdirp/issues
- npm.io page: https://npm.io/package/async-mkdirp

## Alternatives

- [@commercetools/sync-actions](https://npm.io/package/@commercetools/sync-actions.md) — 25.1K weekly downloads
- [cwait](https://npm.io/package/cwait.md) — 21.4K weekly downloads
- [@ledgerhq/hw-app-cosmos](https://npm.io/package/@ledgerhq/hw-app-cosmos.md) — 4.2K weekly downloads
- [@financial-times/o-loading](https://npm.io/package/@financial-times/o-loading.md) — 2.8K weekly downloads
- [fa](https://npm.io/package/fa.md) — 185 weekly downloads

## Recent versions

- 1.2.7 (latest) — 2018-11-02
- 1.2.6 — 2018-11-01
- 1.2.5 — 2018-11-01
- 1.2.4 — 2018-07-13
- 1.2.3 — 2018-07-13
- 1.2.2 — 2018-07-13
- 1.2.1 — 2018-07-13
- 1.2.0 — 2017-08-28
- 1.1.1 — 2017-03-09
- 1.1.0 — 2017-03-09
- 1.0.0 — 2017-03-09

## README

# DEPRECATED

This project has been deprecated in favor of node's built in `fsPromises.mkdir` added in node v10.0.0

How to use node's built in method instead of this package:

```js
const path = '/my/path/to/anything';
await fsPromises.mkdir(path, { recursive: true });

// With mode
const path = '/my/path/to/anything';
await fsPromises.mkdir(path, { recursive: true, mode: 0o775 });

// With partial application proposal
const path = '/my/path/to/anything';
const mkdirp = fsPromises.mkdir(?, { recursive: true, mode: 0o775 });
await mkdirp(path);

// Partial application with arrow functions
const path = '/my/path/to/anything';
const mkdirp = path => fsPromises.mkdir(path, { recursive: true, mode: 0o775 }));
await mkdirp(path);
```

# async-mkdirp

[![npm][npm]][npm-url]
[![npm bundle size (minified + gzip)][minzip]][minzip-url]
![npm downloads](https://img.shields.io/npm/dt/async-mkdirp.svg)

Recursively create directories, like `mkdir -p`, and return a promise.

# Install

```
npm install -S async-mkdirp
```

## Usage

Normal:

```js
const mkdirp = require('async-mkdirp');

(async () => {
  await mkdirp('/tmp/foo/bar/baz');
  // Code here runs after all directories have been created
})();
```

Make multiple paths in parallel:

```js
const mkdirp = require('async-mkdirp');

const createDirs = async () => {
  await Promise.all([
    mkdirp('/tmp/foo/bar/baz'),
    mkdirp('./my/cool/folder'),
  ]);
  // Code here runs after all directories have been created
}

createDirs();
```

# API

## mkdir(path[, mode])

- `path` `<String>` | `<Buffer>`
- `mode` `<Integer>`

Asynchronous `mkdir -p`. `mode` defaults to `0o777`.

# About

This project is inspired by [`substack/mkdirp`](https://github.com/substack/node-mkdirp). It has been rewritten to take advantage of `async` functions, and does not include a synchronous method or cli.

# Similar projects

- [node-mkdirp](https://github.com/substack/node-mkdirp) - callback style mkdirp, with cli
- [mkdirp-promise](https://github.com/ahmadnassri/mkdirp-promise) - node-mkdirp wrapped in a promise
- [mkdirp-then](https://github.com/fs-utils/mkdirp-then) - node-mkdirp wrapped in a promise, and any-promise for promise implementation

# License

MIT

[npm]: https://img.shields.io/npm/v/async-mkdirp.svg
[npm-url]: https://npmjs.com/package/async-mkdirp

[minzip]: https://img.shields.io/bundlephobia/minzip/async-mkdirp.svg
[minzip-url]: https://bundlephobia.com/result?p=async-mkdirp

---
_Source: https://npm.io/package/async-mkdirp · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
