src/index.js
function removeDir(dirPath, cleanOnly) {
  var files;

  try {
    files = fs.readdirSync(dirPath);
  } catch(e) {
    return;
  }

  if (files.length > 0) {
    for (var i = 0; i < files.length; i++) {
      var filePath = path.join(dirPath, files[i]);
      if (fs.statSync(filePath).isFile())
        fs.unlinkSync(filePath);
      else
        rmDir(filePath);
    }
  }

  !cleanOnly && fs.rmdirSync(dirPath);
}
function removeDir(dirPath, cleanOnly) {
  var files;

  try {
    files = fs.readdirSync(dirPath);
  } catch(e) {
    return;
  }

  if (files.length > 0) {
    for (var i = 0; i < files.length; i++) {
      var filePath = path.join(dirPath, files[i]);
      if (fs.statSync(filePath).isFile())
        fs.unlinkSync(filePath);
      else
        rmDir(filePath);
    }
  }

  !cleanOnly && fs.rmdirSync(dirPath);
}
function removeDir ( dirPath , cleanOnly ) { var files ; try { files = fs . readdirSync ( dirPath ) ; } catch ( e ) { return ; } if ( files . length > 0 ) { for ( var i = 0 ; i < files . length ; i ++ ) { var filePath = path . join ( dirPath , files [ i ] ) ; if ( fs . statSync ( filePath ) . isFile ( ) ) fs . unlinkSync ( filePath ) ; else rmDir ( filePath ) ; } } ! cleanOnly && fs . rmdirSync ( dirPath ) ; }
Removes a directory and its cotents
If cleanOnly is true then only the contents are removed
@param  {String} dirPath
@param  {boolean} cleanOnly
Removes a directory and its cotents If cleanOnly is true then only the contents are removed