enfsmkdirp-promisedeprecated

mkdir -p for node fs module with promises

Usage no npm install needed!

<script type="module">
  import enfsmkdirpPromise from 'https://cdn.skypack.dev/enfsmkdirp-promise';
</script>

README

Build Status AppVeyor status Codacy Badge Donate

NPM

enfsmkdirp-promise

Module that add mkdir -p functionality to node fs module with promises

enfs stands for [E]asy [N]ode [fs]

This module is intended to work as a sub-module of enfs

Description

This module will add a method that allows the creation o directories and sub-directories with one command line. Add mkdir -p functionality to node fs module

  • This module will add following methods to node fs module:
    • mkdirpP

Usage

enfsmkdirp

    const enfsmkdirp = require("enfsmkdirp-promise");

Errors

All the methods follows the node culture.

  • Async: Every async method returns an Error in the first callback parameter
  • Sync: Every sync method throws an Error.

Additional Methods

mkdirpP

  • mkdirpP(path, [options])

Asynchronously create multiple directories levels

path The path can be on the form of a string, an array or "brace-string"

[options]:

  • fs (Object): an alternative fs module to use (default will be enfspatch)
  • mode (String or Number): the mode that will be attributed to the directory being created
  • Path (String)
    enfsmkdirp.mkdirpP("/home/path/to/folder").then(function(){
        //do something
    });
  • Path (Array)
    enfsmkdirp.mkdirpP(["/home/path/to/folder","/var/home/test"]).then(function(){
        //do something
    });
  • Path ("brace-string")
    enfsmkdirp.mkdirpP("./project/{development,production}/{public,css,private,test}").then(function(){
        //do something
    });

License

Creative Commons Attribution 4.0 International License

Copyright (c) 2017 Joao Parreira joaofrparreira@gmail.com GitHub

This work is licensed under the Creative Commons Attribution 4.0 International License. To view a copy of this license, visit CC-BY-4.0.