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 🙏

© 2025 – Pkg Stats / Ryan Hefner

strapi-migrate-to-cloudflare-r2

v1.0.10

Published

Strapi plugin to migrate media to Cloudflare R2

Readme

Strapi Migrate to Cloudflare R2

Strapi plugin for migrating and managing media files in Cloudflare R2 storage. This plugin provides tools to migrate images from local storage to Cloudflare R2, change CDN domains, and reupload images to apply new resize settings.

Features

  • Media Migration: Automatically migrate all media files from local storage to Cloudflare R2
  • Domain Changer: Update CDN domain URLs for all files stored in R2
  • Image Reupload: Reupload all images to apply new resize settings (useful when you change responsive image plugin configurations)

Installation

# using yarn
yarn add strapi-migrate-to-cloudflare-r2

# using npm
npm install strapi-migrate-to-cloudflare-r2 --save

# using pnpm
pnpm add strapi-migrate-to-cloudflare-r2

Prerequisites

This plugin requires strapi-provider-cloudflare-r2 to be installed and configured.

Make sure you have the following environment variables set in your .env file:

CF_ACCESS_KEY_ID=your_access_key_id
CF_ACCESS_SECRET=your_secret_access_key
CF_ENDPOINT=https://<ACCOUNT_ID>.r2.cloudflarestorage.com
CF_BUCKET=your_bucket_name
CF_PUBLIC_ACCESS_URL=https://pub-<YOUR_PUBLIC_BUCKET_ID>.r2.dev

Usage

After installation, navigate to the plugin page in Strapi admin panel. You'll find three main actions:

1. Run All Media Migration

Migrates all media files from local storage to Cloudflare R2. Files that are already on R2 will be skipped.

When to use:

  • Initial migration of all media to R2
  • Moving from local storage to cloud storage

2. Run All Media Domain Changer

Updates the CDN domain URL for all files stored in R2. Useful when you change your Cloudflare R2 public access URL.

When to use:

  • After changing CF_PUBLIC_ACCESS_URL in your configuration
  • When switching between different CDN endpoints

3. Reupload All Images

Reuploads all images to R2, applying current resize settings. This is particularly useful when you've changed the configuration of responsive image plugins (like strapi-plugin-responsive-image).

Features:

  • Downloads images from R2 (or uses local files)
  • Reuploads them through Strapi upload service
  • Applies new resize formats (large, medium, small, thumbnail, etc.)
  • Automatically deletes old files from R2 to prevent duplicates
  • Works with both R2-stored and locally-stored images

When to use:

  • After changing responsive image plugin settings
  • When you need to regenerate image formats with new dimensions
  • To apply new image processing configurations to existing files

How It Works

Migration Process

  1. Scans all files in Strapi media library
  2. Identifies files not yet migrated to R2
  3. Uploads files to R2 via Strapi upload service
  4. Updates file records with new R2 URLs and formats
  5. Removes temporary database entries

Reupload Process

  1. Finds all image files (both on R2 and local)
  2. Downloads files from R2 or copies from local storage
  3. Reuploads through Strapi upload service (applies current resize settings)
  4. Updates file records with new formats
  5. Deletes old files from R2 to prevent storage bloat
  6. Cleans up temporary files

Screenshot

Plugin Interface

Requirements

  • Strapi 4.x
  • Node.js >= 18.0.0 <= 20.x.x
  • strapi-provider-cloudflare-r2 configured

License

MIT

Author

Anrail