1.0.3 • Published 5 years ago

create-dir v1.0.3

Weekly downloads
24
License
MIT
Repository
github
Last release
5 years ago

Create Directory Recursively

Build Status Test Covarage Greenkeeper Latest Version

Create directory recursively.

It works similar to the mkdir -p. For Node >= 10.12.0, it will use the built-in mkdir recursive option.

Installation

$ npm install create-dir

Usage

const createDir = require("create-dir");

(async () => {
  try {
    await createDir("foo/bar/baz");
  } catch(error) {
    console.error(error.message);
  }
})();

API

createDir(path, [mode])

Parameters

  • path (String): The path directory to create.
  • mode (optional Number): Directory permission, default to 0o777.

Returns

It returns a Promise which when resolved contains a true value.

Related

  • write-to-file: Module to write data to file and automatically create its directories if not exists.

License

MIT © Risan Bagja Pradana