https://github.com/sabrehagen/empty-aws-bucket
Empty an Amazon S3 Bucket
https://github.com/sabrehagen/empty-aws-bucket
aws bucket empty s3
Last synced: about 1 year ago
JSON representation
Empty an Amazon S3 Bucket
- Host: GitHub
- URL: https://github.com/sabrehagen/empty-aws-bucket
- Owner: sabrehagen
- Created: 2017-10-12T08:47:40.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2019-01-10T07:16:13.000Z (over 7 years ago)
- Last Synced: 2025-04-15T05:13:32.672Z (about 1 year ago)
- Topics: aws, bucket, empty, s3
- Language: JavaScript
- Size: 9.77 KB
- Stars: 3
- Watchers: 2
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Empty S3 Bucket
For a given S3 bucket, all objects and their versions will be deleted.
## Getting Started
### Run
```
npm install --save empty-aws-bucket
```
### API
The first argument is the bucket name, and the second argument is an optional config object passed to the [AWS SDK](http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Config.html#constructor-property).
```
emptyBucket(bucketName, [config]);
```
### Usage
```
const emptyBucket = require('empty-aws-bucket');
emptyBucket('my-bucket');
const awsConfig = {
accessKeyId: 'AKID',
secretAccessKey: 'SECRET',
region: 'us-west-2'
};
emptyBucket('other-bucket', awsConfig);
```
### Debugging
The [`AWSJS_DEBUG`](https://github.com/aws/aws-sdk-js/blob/master/CHANGELOG.md#21420) environment variable enables logging in `aws-sdk`. If the `AWSJS_DEBUG` environment variable is set this module will log debug information also.