del.js 312 B

1234567891011121314
  1. var rimraf = require( 'rimraf' ).sync;
  2. var fs = require( 'graceful-fs' );
  3. module.exports = function del( file ) {
  4. if ( fs.existsSync( file ) ) {
  5. //if rimraf doesn't throw then the file has been deleted or didn't exist
  6. rimraf( file, {
  7. glob: false
  8. } );
  9. return true;
  10. }
  11. return false;
  12. };