Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork22
Make a directory and its parents if needed - Think `mkdir -p`
License
sindresorhus/make-dir
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Make a directory and its parents if needed - Think
mkdir -p
Tip
You probably want the built-infsPromises.mkdir('…', {recursive: true})
instead.
- Supports a custom
fs
implementation.
Advantages overmkdirp
- Promise API(Async/await ready!)
- Fixes many
mkdirp
issues - CI-tested on macOS, Linux, and Windows
- Actively maintained
- Doesn't bundle a CLI
- Uses the native
fs.mkdir/mkdirSync
recursive
option in Node.js unlessoverridden
npm install make-dir
$pwd/Users/sindresorhus/fun$tree.
import{makeDirectory}from'make-dir';constpath=awaitmakeDirectory('unicorn/rainbow/cake');console.log(path);//=> '/Users/sindresorhus/fun/unicorn/rainbow/cake'
$tree.└── unicorn └── rainbow └── cake
Multiple directories:
import{makeDirectory}from'make-dir';constpaths=awaitPromise.all([makeDirectory('unicorn/rainbow'),makeDirectory('foo/bar')]);console.log(paths);/*['/Users/sindresorhus/fun/unicorn/rainbow','/Users/sindresorhus/fun/foo/bar']*/
Returns aPromise
for the path to the created directory.
Returns the path to the created directory.
Type:string
The directory to create.
Type:object
Type:integer
Default:0o777
The directorypermissions.
Type:object
Default:import fs from 'node:fs'
Use a customfs
implementation. For examplegraceful-fs
.
Using a customfs
implementation will block the use of the nativerecursive
option iffs.mkdir
orfs.mkdirSync
is not the native function.
About
Make a directory and its parents if needed - Think `mkdir -p`
Resources
License
Code of conduct
Security policy
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
Packages0
Contributors11
Uh oh!
There was an error while loading.Please reload this page.