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

@zamdevio/cfworker

v2.0.0

Published

Download Cloudflare Workers from Wrangler OAuth profiles, strip multipart wrappers, and split esbuild bundles into a file tree.

Readme

License: MIT Node.js >= 20 TypeScript pnpm


Recover a Worker you already shipped. Credentials come from Wrangler or cfworker login. A download is staged first, and files that differ are not overwritten unless you choose that.

| Surface | URL | Role | |---------|-----|------| | npm | @zamdevio/cfworker | Global cfworker command | | GitHub | github.com/zamdevio/cfworker | Source, issues, changelog |

Install

Requires Node.js >= 20.

# global CLI
npm install -g @zamdevio/cfworker
# or: pnpm add -g @zamdevio/cfworker
# on-demand without a global install
npx @zamdevio/cfworker --help
pnpm dlx @zamdevio/cfworker --help

Quick start

cfworker profiles
cfworker accounts --profile zamdevio
cfworker list --profile zamdevio --account <account_id>
cfworker download --profile zamdevio --account <account_id> --worker <name> --src-only
cfworker split ./bundle.js --out ./recovered/<name>/split --src-only

JSON for scripts:

cfworker profiles --json
cfworker list --profile zamdevio --account <account_id> --json

Bare cfworker prints help. Missing flags prompt only when stdin and stdout are TTYs. --json never prompts.

Commands

| Command | Purpose | |---------|---------| | profiles | List Wrangler, cfworker, and env credentials, with the source | | login | Check a token against the API and save ~/.config/cfworker/<profile>.toml | | accounts | List Cloudflare accounts for a profile | | list | List Worker scripts in an account | | download | Download, unwrap, and split one Worker | | split | Split a bundle you already have on disk |

whoami is profiles. auth is login.

Download flags: --out, --name, --src-only, --no-split, --prettier, --force, --json.

With no --out, a TTY asks for a destination. The suggestion is ./recovered/<worker> from the current directory (CFWORKER_OUT changes the root). --out is that root, and the worker folder is created inside it.

If the folder already has different files, a TTY can overwrite, update, or merge. Otherwise the command stops until you pass --force. Identical files stay put. meta.json is refreshed every time and is not a conflict.

Output

recovered/<worker>/
  bundle.js
  meta.json
  parts/            # extra multipart modules, when the upload had more than one
  split/
    _preamble.js    # esbuild preamble, when the bundle has one

A missing Worker is an error and does not create the folder. The body is written in a temp directory first, then moved into the destination. A temp directory is rejected as the final path.

Auth

Profiles are read from:

  1. ~/.config/cfworker/<name>.toml after cfworker login
  2. Wrangler v4, ~/.config/.wrangler/config/<name>.toml
  3. Wrangler v3, ~/.wrangler/config/<name>.toml

--profile env uses CLOUDFLARE_API_TOKEN, CF_API_TOKEN, or CFWORKER_TOKEN. If that is the only credential, it is selected for you. An env token does not replace a named profile that has a file.

Wrangler access tokens expire. cfworker exchanges the stored refresh token and writes the new tokens back to that Wrangler profile, the same way wrangler whoami does. One rejected call refreshes and retries once.

JSON

Success goes to stdout:

{ "ok": true, "command": "profiles", "profiles": [] }

Failure also goes to stdout and exits 1:

{ "ok": false, "error": "..." }

Environment

| Variable | Role | |----------|------| | CFWORKER_OUT | Download root. Default ./recovered from the working directory | | CFWORKER_CONFIG_DIR | cfworker profile directory | | WRANGLER_CONFIG_DIR | Wrangler config directory. Several paths use the platform path delimiter | | CLOUDFLARE_API_TOKEN, CF_API_TOKEN, CFWORKER_TOKEN | Token for --profile env | | WRANGLER_CLIENT_ID, WRANGLER_TOKEN_URL, WRANGLER_AUTH_DOMAIN | Overrides for the OAuth refresh request | | NO_COLOR | Turn color off |

Development

pnpm install
pnpm cfworker --help    # runs TypeScript through tsx
pnpm typecheck
pnpm test
pnpm lint
pnpm build              # dist/ for the published bin

The cfworker binary on npm runs dist/. prepublishOnly builds it.

License

MIT — see LICENSE.