1.0.0-alpha.8 • Published 2 months ago

s3-empty-bucket v1.0.0-alpha.8

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
2 months ago

s3-empty-bucket

DO NOT USE FOR THE MOMENT. There's a bug in the code that may result in excessive API calls. We will address later today.

Special notice ends.


Library and CLI to quickly empty AWS S3 buckets.

While we expect this library to work in most cases, it has not been extensively tested. However, we actively support this library so please submit any issues and we'll be happy to look into it.

Installation

To install the library:

npm i --omit peer s3-empty-bucket # peer deps only needed for CLI

To install the CLI (globally):

npm i -g s3-empty-bucket

Usage

Library

import { S3Client } from '@aws-sdk/client-s3'
import { fromIni } from '@aws-sdk/credential-providers'

import { emptyBucket } from 's3-empty-bucket' // ES6
// const { emptyBucket } = require('s3-empty-bucket') // cjs

// following works with API keys, include the profile when using SSO sessions
const credentials = fromIni(/* { profile : ssoProfile }*/)
const s3Client = new S3Client({ credentials })

emptyBucket({ bucketName, s3Client, verbose: false })

CLI

# following works with API keys, include the profile when using SSO sessions
s3-empty-bucket my-bucket-name # --profile your-sso-profile

API Reference

API generated with dmd-readme-api.

emptyBucket(options)

Empties AWS S3 bucket.

ParamTypeDescription
optionsobjectThe destructured options object.
options.bucketNamestringThe name of the bucket to empty.
options.doDeletebooleanIf true, then deletes the bucket after emptying it.
options.s3ClientobjectAuthenticated S3Client.
options.verbosebooleanWhen true, will report actions to process.stdout.

Source code

CLI command reference

Usage

s3-empty-bucket <options> [bucketName]

Options

OptionDescription
[bucketName](main argument,required) The name of the bucket to empty.
--deleteDeletes the bucket after emptying it.
--documentGenerates command line documentation in Markdown format. All other options are ignored.
--help, -?Prints command help.
--profile, -pThe SSO profile to use.
--quiet, -qSuppresses output.
--throw-errorInstead of printing simple message, allows exceptions to bubble up to the user.

Contributing

Plase feel free to submit any bug reports or feature suggestions. You're also welcome to submit patches of course. We don't have a full contributors policy yet, but you can post questions on our discord channel. It's not monitored 24/7, but you should hear back from us by next business day generally.

Support and feature requests

The best way to get free support is to submit a ticket. You can also become a patron for as little as $1/month and get priority support and request new feature on all Liquid Labs open source software. You can get these benefits and support our work at patreon.com/zanecodes.

1.0.0-alpha.8

2 months ago

1.0.0-alpha.7

2 months ago

1.0.0-alpha.6

3 months ago

1.0.0-alpha.5

3 months ago

1.0.0-alpha.4

3 months ago

1.0.0-alpha.3

3 months ago

1.0.0-alpha.2

3 months ago

1.0.0-alpha.1

3 months ago