Skip to content

YxxY/mkdirs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

npm npm Travis AppVeyor Coveralls

mkdirs

a lightweight package making directory recursively and asynchronously in node.js

Example

example.js

var mkdirs = require('util-mkdirs')
//absolute path
mkdirs('/path/to/dir', (err, fp)=>{
    if(err){
        console.log(err)
        return
    }
    console.log(fp)
    //do something else
})

//relative path
mkdirs('./path/to/dir', (err, fp)=>{
    if(err){
        console.log(err)
        return
    }
    console.log(fp)
    //do something else
})

Usage

install

npm i util-mkdirs --save

import

var mkdirs = require('util-mkdirs')

arguments

mkdirs(dirpath [,mode] [,callback])
  • dirpath: [required] {string|buffer} relative or absolute path
  • mode: [options] {string|number} default 777 which will finally convert to an oct number
  • callback: [options] {function} a function with two paras: err,fp. if everything is fine, err will be null and fp refers to the dirpath you created.

Test

npm install
npm test

Tips

make sure you have the permission to create the aimed directory. Once the directory exist already, nothing will happen.

License

MIT

About

Creates a directory and all its parent directories recursively and asynchronously in node.js

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published