Torrent download + Cloudflare R2 upload CLI with persistent JSON state and queue event callbacks.
# Download selected files from a magnet
node dist/cli.js download "magnet:?xt=urn:btih:..."
# Upload selected files from latest job state (or --job <infoHash>)
node dist/cli.js upload --job <infoHash>
# Direct upload fallback from folder
node dist/cli.js upload ./downloads
# Inspect saved state
node dist/cli.js state
node dist/cli.js state --json
# Backfill queue events from existing R2 objects
node dist/cli.js backfill --dry-run
node dist/cli.js backfill
node dist/cli.js backfill --all-keys- Path:
.seedstorm-state/state.json - Tracks per job:
- selected files
- download progress/status
- upload progress/status
Required:
R2_ACCESS_KEY_ID=...
R2_SECRET_ACCESS_KEY=...
R2_BUCKET=...
R2_ENDPOINT=https://<accountid>.r2.cloudflarestorage.comOptional:
R2_PREFIX=
R2_CONCURRENCY=6Worker endpoint defaults to:
https://queue-backend.sargam.workers.dev
Sent events:
torrent_downloaded(after download completes)hls_generating(when upload starts)hls_uploaded(when upload completes)failed(download/upload failure)
Payload shape:
{
"id": "job-id",
"status": "torrent_downloaded|hls_generating|hls_uploaded|failed",
"torrentKey": "optional",
"hlsKey": "optional",
"meta": {}
}Queue env controls:
QUEUE_BACKEND_URL=https://queue-backend.sargam.workers.dev
QUEUE_EVENTS_ENABLED=true # set false/0/no to disable