This is a CLI tool to synchronise a local directory with Cloudflare Images.
Features
- Syncs an entire directory, rather that 1 file at a time.
- Skips files already uploaded.
- Uses the relative filepath as the image ID, so the final CDN URLs are predictable.
- Optionally resizes images before uploading, which speeds up Cloudflare's dynamic image resizing.
Installation
npm install -g cloudflare-sync
Usage
Ensure you have a CLOUDFLARE_API_TOKEN
environment variable set. Then use the CLI:
npx cloudflare-sync --source ./public --resize 2000x2000 --resizeFit outside --account c495ed7f42a6ac8cb22cc3b822a684cb --ext jpg,png