cli/download.js
function mkdir(dir) {
  return new Promise((resolve, reject) => {
    fs.lstat(dir, (err, stats) => {
      // Resolve, when already is directory
      if (!err) return stats.isDirectory() ? resolve() : reject(new Error(`${dir} is not a direcotry.`));
      // Try to create directory
      fs.mkdir(dir, (err) => {
        err ? reject(err) : resolve();
      });
    })
  })
}
function mkdir(dir) {
  return new Promise((resolve, reject) => {
    fs.lstat(dir, (err, stats) => {
      // Resolve, when already is directory
      if (!err) return stats.isDirectory() ? resolve() : reject(new Error(`${dir} is not a direcotry.`));
      // Try to create directory
      fs.mkdir(dir, (err) => {
        err ? reject(err) : resolve();
      });
    })
  })
}
function mkdir ( dir ) { return new Promise ( ( resolve , reject ) => { fs . lstat ( dir , ( err , stats ) => { // Resolve, when already is directory if ( ! err ) return stats . isDirectory ( ) ? resolve ( ) : reject ( new Error ( ` ${ dir } ` ) ) ; // Try to create directory fs . mkdir ( dir , ( err ) => { err ? reject ( err ) : resolve ( ) ; } ) ; } ) } ) }
Creates a direcotry or ensures that it exists.

@param {string} dir The path where a directory should exist.
@return {Promise<void>} Resolves when the given directory is existing.
Creates a direcotry or ensures that it exists .