lib/file/delete.js
function fileDelete(src, options) {
  options = _.sanitize(options, {exclude: [], deleteDirs: true, onlyEmptyDirs: false});
  let result = true;
  const files = _matchingFilesArray(src, options);
  _.each(files, (f) => {
    const fileWasDeleted = _fileDelete(f, options);
    result = result && fileWasDeleted;
  });
  return result;
}
function fileDelete(src, options) {
  options = _.sanitize(options, {exclude: [], deleteDirs: true, onlyEmptyDirs: false});
  let result = true;
  const files = _matchingFilesArray(src, options);
  _.each(files, (f) => {
    const fileWasDeleted = _fileDelete(f, options);
    result = result && fileWasDeleted;
  });
  return result;
}
function fileDelete ( src , options ) { options = _ . sanitize ( options , { exclude : [ ] , deleteDirs : true , onlyEmptyDirs : false } ) ; let result = true ; const files = _matchingFilesArray ( src , options ) ; _ . each ( files , ( f ) => { const fileWasDeleted = _fileDelete ( f , options ) ; result = result && fileWasDeleted ; } ) ; return result ; }
Delete file or directory
@function $file~delete
@param {string|string[]} source - File or array of files to copy. It also supports wildcards.
@param {Object} [options]
@param {string[]} [options.exclude=[]] - List of patterns used to exclude files when deleting
@param {string} [options.deleteDirs=true] - Also delete directories
@param {string} [options.onlyEmptyDirs=false] - Only delete directories if they are empty
@returns {boolean} Returns true if the path was deleted or false if not
@example
// Delete /foo/bar/sample file
$file.delete('/tmp/bar/sample');
=> true
@example
// Delete /tmp/ files avoiding directories
$file.delete('/tmp/*', {deleteDirs: false});
=> false
Delete file or directory