Catalog npm
PACKAGE EXPLORERView in registry

@0x5b62656e5d/r2-files

npm

A simple CLI tool to manage Cloudflare R2 buckets

aws-sdkclicloudcloudflarer2s3typescript
Versions collected8
Direct dependencies23From release 1.1.0
Last observed20 Oct, 22:37 UTC

README

Current package documentation

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:

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 8

Collected releases
VersionPublishedDirect dependenciesOpen version
1.1.0Registry latest27 May 202523
1.0.65 May 202514
1.0.51 May 202514
1.0.41 May 20258
1.0.330 Apr 20258
1.0.230 Apr 20258
1.0.130 Apr 20258
1.0.030 Apr 20258

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

PENDING
0x5b62656e5d/r2-files

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 22:37 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:d10b9c583c25934f58522313ad9b27ab4e20c3b6f9d03deba7f2e3ce42c75a10