Catalog npm
Back to packageRELEASE DETAILS

1.0.6

npm

@0x5b62656e5d/r2-files

A simple CLI tool to manage Cloudflare R2 buckets

aws-sdkclicloudcloudflarer2s3typescript
Published5 May 2025
Direct dependencies14
Transitive dependenciesNot calculated

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.

Declared dependencies 14

Native requirements
14 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
uuid
Environment
{
  "local_name": "uuid",
  "alias": false,
  "peer_metadata": null
}
^11.1.0runtime
dotenv
Environment
{
  "local_name": "dotenv",
  "alias": false,
  "peer_metadata": null
}
^16.5.0runtime
clipboardy
Environment
{
  "local_name": "clipboardy",
  "alias": false,
  "peer_metadata": null
}
^4.0.0runtime
node-fetch
Environment
{
  "local_name": "node-fetch",
  "alias": false,
  "peer_metadata": null
}
^3.3.2runtime
@aws-sdk/client-s3
Environment
{
  "local_name": "@aws-sdk/client-s3",
  "alias": false,
  "peer_metadata": null
}
^3.799.0runtime
@aws-sdk/lib-storage
Environment
{
  "local_name": "@aws-sdk/lib-storage",
  "alias": false,
  "peer_metadata": null
}
^3.799.0runtime
typescript
Environment
{
  "local_name": "typescript",
  "alias": false,
  "peer_metadata": null
}
^5.8.3development
@types/node
Environment
{
  "local_name": "@types/node",
  "alias": false,
  "peer_metadata": null
}
^22.15.3development
semantic-release
Environment
{
  "local_name": "semantic-release",
  "alias": false,
  "peer_metadata": null
}
^24.2.3development
@semantic-release/git
Environment
{
  "local_name": "@semantic-release/git",
  "alias": false,
  "peer_metadata": null
}
^10.0.1development
@semantic-release/github
Environment
{
  "local_name": "@semantic-release/github",
  "alias": false,
  "peer_metadata": null
}
^11.0.2development
@semantic-release/changelog
Environment
{
  "local_name": "@semantic-release/changelog",
  "alias": false,
  "peer_metadata": null
}
^6.0.3development
@semantic-release/commit-analyzer
Environment
{
  "local_name": "@semantic-release/commit-analyzer",
  "alias": false,
  "peer_metadata": null
}
^13.0.1development
@semantic-release/release-notes-generator
Environment
{
  "local_name": "@semantic-release/release-notes-generator",
  "alias": false,
  "peer_metadata": null
}
^14.0.3development

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "shasum": "f4718c3d318d1b46fc02d8b48bee179e98efed90",
  "tarball": "https://registry.npmjs.org/@0x5b62656e5d/r2-files/-/r2-files-1.0.6.tgz",
  "fileCount": 20,
  "integrity": "sha512-Mk1yq3eY+2/Ogrqgk2Kee2XwnpLU1tIK2H/mGXUylqeqkNMWtTRExw10lyXfyurv90odi6yrKWr2XrvKeFmE4A==",
  "signatures": [
    {
      "sig": "MEMCH1FLuFQklSfYkmVhM98E5IxZRO4bK9am/Vq52STrUBoCIAWguhVrX3JKpH6nWWrxVgyXufUbp/48Br+gtCJu1lDs",
      "keyid": "SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"
    }
  ],
  "unpackedSize": 32327
}

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_version:5acd7bcb4c594067edbe463048410ddaef8bfc468112c5e4b56bce37d96643ea

Other collected versions

1.1.027 May1.0.51 May1.0.41 May1.0.330 Apr1.0.230 Apr1.0.130 AprView all collected versions →