features/extra/cleanup.js
function(bucket, callback) {
    var s3 = new AWS.S3({maxRetries: 100});
    var params = {
      Bucket: bucket
    };

    s3.listObjects(params, function (err, data) {
      if (err) return callback(err);
      if (data.Contents.length > 0) {
        params.Delete = { Objects: [] };
        data.Contents.forEach(function (item) {
          params.Delete.Objects.push({Key: item.Key});
        });
        s3.deleteObjects(params, callback);
      } else {
        callback();
      }
    });
  }
function(bucket, callback) {
    var s3 = new AWS.S3({maxRetries: 100});
    var params = {
      Bucket: bucket
    };

    s3.listObjects(params, function (err, data) {
      if (err) return callback(err);
      if (data.Contents.length > 0) {
        params.Delete = { Objects: [] };
        data.Contents.forEach(function (item) {
          params.Delete.Objects.push({Key: item.Key});
        });
        s3.deleteObjects(params, callback);
      } else {
        callback();
      }
    });
  }
function ( bucket , callback ) { var s3 = new AWS . S3 ( { maxRetries : 100 } ) ; var params = { Bucket : bucket } ; s3 . listObjects ( params , function ( err , data ) { if ( err ) return callback ( err ) ; if ( data . Contents . length > 0 ) { params . Delete = { Objects : [ ] } ; data . Contents . forEach ( function ( item ) { params . Delete . Objects . push ( { Key : item . Key } ) ; } ) ; s3 . deleteObjects ( params , callback ) ; } else { callback ( ) ; } } ) ; }
Delete objects.
Delete objects .