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

@0x5b62656e5d/r2-files

v1.1.0

Published

A simple CLI tool to manage Cloudflare R2 buckets

Readme

r2-files

NPM Version NPM Downloads GitHub Actions Workflow Status Codecov

A simple CLI tool to manage Cloudflare R2 buckets

Description

This CLI tool helps manage files from a Cloudflare R2 bucket. It can download, upload, list, and delete files from the specified bucket. It also automatically copies the link to download the file to the clipboard upon successful upload.

Installation

Install via npm

npm install -g @0x5b62656e5d/r2-files

Setup

Cloudflare setup

This tool requires a Cloudflare account, as well as an active Cloudflare R2 plan. API tokens can be created by heading to Cloudflare's R2 Object Storage Overview page, then heading to the Manage API Tokens page.

Cloudflare R2 API tokens page

Create a token that has Object Read and Write permissions, and note down the Access Key ID, Secret Access Key, and the Endpoint URL for S3 clients. Make sure you already have a bucket created to store files.

Environment variables setup

Create a .env file under the following directory: ~/.config/r2-files/.

Configuration template:

R2_ACCESS_KEY_ID=<Your-R2-Access-Key>
R2_SECRET_ACCESS_KEY=<Your-R2-Secret-Access-Key>
R2_ENDPOINT=<Your-R2-Endpoint>
R2_BUCKET=<Your-R2-Bucket-Name>
DOWNLOAD_URL=<Your-R2-Bucket-URL>

You can link a custom domain to the bucket for the DOWNLOAD_URL. If you don't own a domain, use the Public Development URL for DOWNLOAD_URL. Make sure that the URL does not end with a /.

Usage

NAME
    r2-files - Manage files for a R2 bucket

COMMANDS:
    download <file-key> <download-path> [<download-name>]
        Download a file given the file-key and download-path. Specify download-name to customize the downloaded file's name.
    upload <file-path> [<desired-file-name>]
        Upload a file given the file-path. Specify desired-file-name to customize the uploaded filename in the bucket. Will default to UUID if not desired-file-name is not specified or already exists in the bucket.
    delete <object-key>
        Delete a file given the file-key.
    delete-all -y
        Delete all files in the bucket
    list
        List all the files in the bucket

Examples

Downloads somefile.txt into ~/Downlaods/text.txt

r2-files download somefile.txt ~/Downloads/text.txt

Uploads ~/Downloads/folder/text.txt as text.txt

r2-files upload ~/Downloads/folder/text.txt text.txt

Deletes text.txt from the bucket

r2-files delete text.txt

Deletes all files from the bucket

r2-files delete-all -y

Lists all the files from the bucket

r2-files list

Libraries used in this project: