Socket
Book a DemoInstallSign in
Socket

mkdir-bluebird

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mkdir-bluebird

promise wrapper for node’s fs.mkdir()

Source
npmnpm
Version
1.0.8
Version published
Weekly downloads
3
200%
Maintainers
1
Weekly downloads
 
Created
Source

mkdir-bluebird

NPM version Build Status Coverage Status NSP Status

wraps node’s fs.mkdir(), in a bluebird ( v3.4.6 ) promise that resolves with true if successful or rejects with the Error returned by fs.mkdir(); both results need to be handled by the code calling this function.

installation

npm install mkdir-bluebird

usage

mkdir( path[, mode][, ignore] )

@param {string|buffer} path
@param {number} [mode = 0o777]
@param {boolean} [ignore = true] ignore `EEXIST` directory errors returned by `fs.mkdir()`
@returns {Promise}

default

ignores EEXIST directory errors returned by fs.mkdir()

var mkdir = require( 'mkdir-bluebird' );

mkdir( 'test-dir' )
  .then(
    function( result ) {
      // handle success
    }
  )
  .catch(
    function( err ) {
      // handle error
    }
  )

set ignore to false

acknowledges EEXIST directory errors returned by fs.mkdir()

var mkdir = require( 'mkdir-bluebird' );

mkdir( 'test-dir', null, false )
  .then(
    function( result ) {
      // handle success
    }
  )
  .catch(
    function( err ) {
      // handle error
    }
  )

using node’s path module

the path __dirname/test must exist in order to create the directory test-dir in it

var mkdir = require( 'mkdir-bluebird' );
var path = require( 'path' );
var dirpath = path.join( __dirname, 'test', 'test-dir' );

mkdir( dirpath )
  .then(
    function( result ) {
      // handle success
    }
  )
  .catch(
    function( err ) {
      // handle error
    }
  )

license

MIT License

Keywords

bluebird

FAQs

Package last updated on 09 Sep 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts