delete

Delete files and folders and any intermediate directories if they exist (sync and async).

Also see

  • del if you need globbing. This lib was inspired by del, I wanted a quick solution that prevented accidental deletion of files outside the current working directory, but for individual files and without the extra dependencies.

  • write for writing files to disk.

Install

Install with npm:

npm i delete --save-dev

Usage

var del = require('delete');

// delete files asynchronously
del('tmp/foo.md', function(err) {
  if (err) {throw err;}
});

// delete files synchronously
del.sync('tmp/foo.md');

options.force

An error is thrown if you try to delete files outside of the current working directory (cwd).

Override the default behavior:

del.sync('../foo.md', {force: true});

Author

Jon Schlinkert

License

Copyright (c) 2014 Jon Schlinkert, contributors. Released under the MIT license

This file was generated by verb-cli on September 22, 2014.

Last updated