npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

s3-empty-bucket

v1.0.0-alpha.8

Published

Library and CLI to quickly empty AWS S3 buckets.

Downloads

32

Readme

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.

| Param | Type | Description | | --- | --- | --- | | options | object | The destructured options object. | | options.bucketName | string | The name of the bucket to empty. | | options.doDelete | boolean | If true, then deletes the bucket after emptying it. | | options.s3Client | object | Authenticated S3Client. | | options.verbose | boolean | When true, will report actions to process.stdout. |

Source code

CLI command reference

Usage

s3-empty-bucket <options> [bucketName]

Options

|Option|Description| |------|------| |[bucketName]|(main argument,required) The name of the bucket to empty.| |--delete|Deletes the bucket after emptying it.| |--document|Generates command line documentation in Markdown format. All other options are ignored.| |--help, -?|Prints command help.| |--profile, -p|The SSO profile to use.| |--quiet, -q|Suppresses output.| |--throw-error|Instead 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.