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 🙏

© 2026 – Pkg Stats / Ryan Hefner

gai-cli-r2bucket

v1.0.1

Published

CLI tool for Cloudflare R2 bucket operations

Readme


name: r2bucket description: "CLI tool for Cloudflare R2 bucket operations. Use when: uploading, downloading, listing, or deleting objects in an R2 bucket. Requires: R2_ACCOUNT_ID, R2_ACCESS_KEY_ID, R2_SECRET_ACCESS_KEY env vars." homepage: https://github.com/kakkoii1337/gai-cli-r2bucket

r2bucket

CLI tool for Cloudflare R2 bucket operations. Uses the S3-compatible API via @aws-sdk/client-s3.

Requirements

  • Node.js >= 18.0.0
  • Cloudflare account with R2 enabled
  • R2 API token (see Configuration)

Installation

npm install -g gai-cli-r2bucket

Or run directly:

npx gai-cli-r2bucket list

Configuration

1. Create an R2 API Token

  1. Go to Cloudflare Dashboard → R2 → Manage R2 API Tokens
  2. Click Create API Token
  3. Select Object Read & Write permissions
  4. Copy the Access Key ID and Secret Access Key (shown once)
  5. Get your Account ID from the Cloudflare dashboard sidebar

2. Set Environment Variables

In a .env file (or export to your shell):

R2_ACCOUNT_ID=your_account_id
R2_ACCESS_KEY_ID=your_access_key_id
R2_SECRET_ACCESS_KEY=your_secret_access_key
R2_BUCKET_NAME=your_default_bucket

Usage

r2bucket list [--bucket=<name>] [--prefix=<prefix>]
r2bucket upload <file> [--bucket=<name>] [--key=<key>]
r2bucket download <key> [--bucket=<name>] [--output=<file>]
r2bucket delete <key> [--bucket=<name>]
r2bucket info <key> [--bucket=<name>]

Options

  • --bucket=<name> - Bucket name (default: R2_BUCKET_NAME env var)
  • --prefix=<prefix> - Filter list by key prefix
  • --key=<key> - Override object key on upload (default: filename)
  • --output=<file> - Output path for download (default: key basename)
  • --help, -h - Show help message

Examples

# List all objects
r2bucket list

# List with prefix filter
r2bucket list --prefix=images/

# Upload a file
r2bucket upload ./photo.jpg
r2bucket upload ./photo.jpg --key=uploads/photo.jpg

# Download a file
r2bucket download uploads/photo.jpg
r2bucket download uploads/photo.jpg --output=./local.jpg

# Delete a file
r2bucket delete uploads/photo.jpg

# Get file metadata
r2bucket info uploads/photo.jpg

Output

list

KEY                                                          SIZE  LAST MODIFIED
----------------------------------------------------------------------------------------------------
uploads/photo.jpg                                         1.2 MB  2026-04-01 10:00:00
uploads/video.mp4                                        45.3 MB  2026-04-01 11:00:00

2 object(s)

info

{
  "key": "uploads/photo.jpg",
  "bucket": "my-bucket",
  "size": 1234567,
  "size_human": "1.2 MB",
  "content_type": "image/jpeg",
  "last_modified": "2026-04-01T10:00:00.000Z",
  "etag": "\"abc123\"",
  "metadata": {}
}