Skip to content

2.0.0 - Promisification

Compare
Choose a tag to compare
@sindresorhus sindresorhus released this 23 Sep 15:52
· 87 commits to main since this release

The API now returns a promise instead of accepting a callback function.

Update your code accordingly:

 var del = require('del');

- del('unicorn.png', function (error, paths) {
+ del('unicorn.png').then(function (paths) {
     console.log('Deleted files/folders:\n', paths.join('\n'));
 });

And with gulp:

 var gulp = require('gulp');
 var del = require('del');

- gulp.task('clean', function (cb) {
-   del('unicorn.png', cb);
+ gulp.task('clean', function () {
+   return del('unicorn.png');
 });

 gulp.task('default', ['clean']);