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

c3b-assets

v0.6.1

Published

Fingerprints a project's images and syncs them to a Bunny storage zone, writing the d8e-asset-manifest.json d8e reads.

Readme

c3b-assets

Fingerprints a project's images, audio and video and syncs them to a Bunny storage zone, so media never lives in git and never needs uploading by hand. Writes d8e-asset-manifest.json, which d8e (1.2.0+) uses to point every reference at the CDN.

How it works

Run c3b-assets u in a project root whenever you add, change or remove an image under src/asset/. It:

  1. Fingerprints each image from its content — asset/hero-banner.webp is stored as colab-asset-manager/hero-banner.3f2a9c1e.webp. Change the image and it gets a new name automatically, so it can be cached forever and a stale copy can never be served.
  2. Uploads the ones the storage zone doesn't have yet (checksum-verified).
  3. Writes d8e-asset-manifest.json: each image's path under src/ and its CDN URL. Commit this file — it's a few KB.
  4. Deletes files nobody references any more, 7 days after they stopped being referenced, so pages in browser caches, sent emails and older staging builds keep working in the meantime.

Code keeps referencing images normally (<img src="asset/hero-banner.webp">, url(../asset/hero-banner.webp)), so local dev still works by opening src/. At deploy, d8e rewrites those references to the CDN URLs and leaves the images out of dist/.

It only ever lists, uploads to and deletes inside the zone's colab-asset-manager/ folder (the tool's old name, kept so existing zones need no re-upload) — files uploaded by hand anywhere else in the zone are never touched. Supported: images avif, gif, jpeg, jpg, png, svg, webp; audio mp3, m4a, ogg, wav; video mp4, webm. Anything else under src/asset/ (fonts, say) stays in git and in dist/.

It runs on your machine only, never at deploy: the storage key stays off Heroku and Vercel, and staging can't delete production's images.

Setup

1. Install

npm install -g c3b-assets@latest

2. Add c3b-assets.json to the project root

{
  "storageZone": "viking-gear",
  "storageHost": "jh.storage.bunnycdn.com",
  "cdnUrl": "https://viking-gear-pz.b-cdn.net"
}
  • storageZone: the storage zone's name.
  • storageHost: optional, defaults to storage.bunnycdn.com (Frankfurt). Use the zone's primary region: uk., ny., la., sg., se., br., jh. (Johannesburg) or syd.storage.bunnycdn.com.
  • cdnUrl: the pull zone connected to that storage zone. s downloads from it with a plain GET, so leave the pull zone's Allowed Referrers, Block No-Referrer Requests and Token Authentication off, or the download gets a 403.

3. Gitignore the media

src/asset/**/*.avif
src/asset/**/*.gif
src/asset/**/*.jpeg
src/asset/**/*.jpg
src/asset/**/*.png
src/asset/**/*.svg
src/asset/**/*.webp
src/asset/**/*.mp3
src/asset/**/*.m4a
src/asset/**/*.ogg
src/asset/**/*.wav
src/asset/**/*.mp4
src/asset/**/*.webm

If the images are already committed, also run git rm -r --cached src/asset once (it keeps your local copies). Their old versions stay in git history.

4. Set the storage key

BUNNY_STORAGE_KEY is the storage zone password: Bunny dashboard → Storage → your zone → FTP & API Access. Keep it in your shell profile or a password manager — never in the repo.

Usage

c3b-assets             # status: src/asset/ against the manifest — new, changed, missing, removed, retired. Changes nothing, no key needed
c3b-assets u           # upload: fingerprint, upload new images, write d8e-asset-manifest.json (deletes need --allow-removals)
c3b-assets s           # sync: download the images the manifest lists that are missing locally, then upload as "u"
c3b-assets a           # adopt: no manifest yet (a repo started over)? rebuild it from what the zone holds, then download
c3b-assets --help      # the commands and flags

a is for a checkout that has no d8e-asset-manifest.json but whose zone already has the images — a repo started over, or a project joining an existing zone: it lists the tool's folder in the zone, reads every stored image back to its manifest key (colab-asset-manager/arch/x.2ed3ab61.webp → asset/arch/x.webp), writes the manifest and downloads as s does. A key stored under several fingerprints keeps the most recently changed copy and retires the rest from today.

Over an existing manifest, a adds only what's missing: the files src/ references (outside src/asset/) that are neither in the manifest nor on disk, taken from the zone and downloaded — the fix when another machine uploaded images and its manifest never reached the repo. Nothing already in the manifest changes, and nothing is retired or deleted. A file the zone holds under more than one fingerprint is refused, not guessed at; a file on neither is counted, for whoever has it to upload.

Flags: --dry-run (report, change nothing), --allow-removals (see Safety checks). The version is printed first, so you can tell which install is running.

s needs no key to download — the CDN is public — and only asks for BUNNY_STORAGE_KEY if there is something to upload or delete afterwards. So a fresh clone on a machine without the key still gets its images.

Changing an image

  1. Fresh clone? Run c3b-assets s first — images aren't in git, so src/asset/ starts empty.
  2. Replace, add or remove the file in src/asset/ (kebab-case names). Keeping the same name for a replacement is fine: the fingerprint changes anyway. Check it locally by opening src/.
  3. c3b-assets to see what will happen, c3b-assets u --dry-run if you want the exact Bunny paths, then c3b-assets u.
  4. Commit d8e-asset-manifest.json (plus any code change that references a new image) and deploy as usual.

If two people sync on different branches, d8e-asset-manifest.json conflicts on merge: pull both sets of images into src/asset/ (c3b-assets s on each) and run c3b-assets u again — it rebuilds the manifest from what's there.

Safety checks

  • Nothing is deleted just because it's missing locally. If images the manifest lists aren't in src/asset/ (a fresh clone, a half-copied folder), u refuses and says to run s. If you removed them on purpose, add --allow-removals.
  • An image someone else removed is not uploaded back. Images aren't in git, so after a teammate removes one your src/asset/ still has it. While Bunny holds the retired copy (the 7-day grace period), a local file with that exact content that nothing under src/ names is reported as removed and skipped by u and s — delete your copy. Name it in a page again and it counts as new, which puts it back. After the grace period the record is gone and a left-over copy reads as new: c3b-lint then flags it as an asset nothing uses.
  • The download step of s never overwrites a local file that differs from Bunny — that's usually a change that hasn't been uploaded yet. It only fills in missing ones, and checks each download against its fingerprint.
  • Deletions only happen inside the zone's colab-asset-manager/ folder, 7 days after a file stopped being referenced, and only with --allow-removals: "unreferenced" is judged from the checkout you run in, which may be a branch that dropped images main still serves. A plain u reports what is due and stops. A folder left empty by those deletions is deleted with them (Bunny keeps empty folders otherwise).
  • Only files this project's manifest has listed are ever retired or deleted. If two projects share a storage zone, neither touches the other's images.
  • The download step of s only fetches image, audio and video files, and only from this project's cdnUrl folder — the manifest is a committed file, so a tampered entry can't plant something else in src/asset/.
  • storageHost must be a Bunny storage endpoint (storage.bunnycdn.com, optionally region-prefixed): the storage key is sent to it, and the config is committed.

Limitations

  • Bunny storage zones have one full-access password (plus a read-only one, which isn't enough to upload). Anyone who uploads needs the full one: share it through a password manager, and regenerate it in Bunny if someone leaves.
  • Videos and other large files stay where they are (Mux / Bunny Stream).

Tests

npm test — Node's built-in test runner, no extra dependency. test/c3b-assets.test.js runs the real CLI against fixture projects and a fake Bunny (test/fake-bunny.js, installed as the global fetch), so nothing reaches the network and no key is needed.

Deploying to npm

  1. FIRST TIME ONLY: run npm login
  2. Bump the version in package.json
  3. npm test
  4. Run npm publish