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

hexo-cloudflare-r2-media

v0.1.1

Published

Hexo deployer for Cloudflare R2 media uploads with HTML rewriting, incremental sync, and stale object cleanup.

Readme

hexo-cloudflare-r2-media

A Hexo deployer plugin that uploads post asset-folder media to Cloudflare R2, rewrites generated HTML to use public R2 URLs, skips unchanged uploads with a local manifest, optionally deletes stale R2 objects, and removes those media files from public/ before your git/static deploy step.

Features

  • Upload media from source/_posts/*/
  • Rewrite generated HTML references to your R2 public domain
  • Skip unchanged files using SHA-256 + file size
  • Delete stale R2 objects that no longer exist locally
  • Keep public/ free of post media before later deployers run

Requirements

  • Node.js >=18
  • Hexo with post_asset_folder: true
  • A Cloudflare R2 bucket plus public custom domain or r2.dev URL

Install

npm install hexo-cloudflare-r2-media

Configuration

Add the plugin before your normal deployer:

r2_media:
  enable: true
  delete_stale: true
  bucket: blog
  endpoint: https://<account-id>.r2.cloudflarestorage.com
  public_base_url: https://storage-blog.example.com
  access_key_id: <r2-access-key-id>
  secret_access_key: <r2-secret-access-key>
  key_prefix: blog

deploy:
  - type: r2-media
  - type: git
    repo: [email protected]:user/user.github.io.git
    branch: master

You can also provide values through environment variables:

  • R2_BUCKET
  • R2_ENDPOINT
  • R2_PUBLIC_BASE_URL
  • R2_ACCESS_KEY_ID
  • R2_SECRET_ACCESS_KEY
  • R2_KEY_PREFIX

How It Works

  1. Scan source/_posts/*/ for image/video assets.
  2. Upload only changed files to R2 using the local manifest .r2-media-manifest.json.
  3. Rewrite matching asset URLs in generated public/**/*.html.
  4. Delete stale R2 objects if delete_stale: true.
  5. Remove post media files from public/ so later deployers do not publish them.

Notes

  • Theme assets such as /img/* are intentionally ignored.
  • Stale-object deletion only affects objects tracked in .r2-media-manifest.json.
  • The manifest stays in your Hexo project root and should usually be committed if you want stable incremental deploys across machines.

Local Development

npm install

Then link it into a Hexo site with:

npm install ./path/to/hexo-cloudflare-r2-media

Publish To npm

From the plugin directory:

npm login
npm publish

If you publish under an npm scope, update the package name first.

License

MIT