lib/util.js
function makeDir(path, callback) {
  fs.mkdir(path, err => {
    if (err) {
      // check if directory exists
      fs.stat(path, (err2, stat) => {
        if (err2 || !stat.isDirectory()) {
          callback(err);
        } else {
          callback();
        }
      });
    } else {
      callback();
    }
  });
}
function makeDir(path, callback) {
  fs.mkdir(path, err => {
    if (err) {
      // check if directory exists
      fs.stat(path, (err2, stat) => {
        if (err2 || !stat.isDirectory()) {
          callback(err);
        } else {
          callback();
        }
      });
    } else {
      callback();
    }
  });
}
function makeDir ( path , callback ) { fs . mkdir ( path , err => { if ( err ) { // check if directory exists fs . stat ( path , ( err2 , stat ) => { if ( err2 || ! stat . isDirectory ( ) ) { callback ( err ) ; } else { callback ( ) ; } } ) ; } else { callback ( ) ; } } ) ; }
Make directory, ignoring errors if directory already exists.
@param {string} path Directory path.
@param {function(Error)} callback Callback.
Make directory ignoring errors if directory already exists .