cfstream

command module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 7, 2026 License: Unlicense Imports: 1 Imported by: 0

README

cfstream

CI Go Report Card Go Version License

A minimal, fast command-line interface for managing Cloudflare Stream videos.

Features

  • 🎥 Upload videos with resumable TUS protocol for large files
  • 📊 Manage videos - list, get, update, delete with rich filtering
  • 🔗 Generate links - preview, signed URLs, thumbnails, HLS/DASH manifests
  • 📦 Embed codes - responsive iframes with customization
  • 🎨 Multiple outputs - table, JSON, or YAML formats
  • Fast & efficient - direct API integration with progress tracking

Installation

go install github.com/kljensen/cfstream@latest

Or build from source:

git clone https://github.com/kljensen/cfstream.git
cd cfstream
go build -o cfstream

Quick Start

1. Configure credentials
cfstream config init

Or use environment variables:

export CFSTREAM_ACCOUNT_ID=your_account_id
export CFSTREAM_API_TOKEN=your_api_token
2. Upload a video
cfstream upload file video.mp4 --name "My Video"
# Preview URL
cfstream link preview VIDEO_ID

# Signed URL (expires in 24h)
cfstream link signed VIDEO_ID --duration 24h

# Thumbnail
cfstream link thumbnail VIDEO_ID --time 30s
4. Get embed code
cfstream embed code VIDEO_ID --responsive --autoplay --muted

Commands

Configuration
cfstream config init              # Interactive setup
cfstream config show              # Display current config
Upload
cfstream upload file video.mp4    # Upload local file
cfstream upload url <url>         # Upload from URL
cfstream upload direct            # Generate direct upload URL
Video Management
cfstream video list               # List all videos
cfstream video get VIDEO_ID       # Get video details
cfstream video update VIDEO_ID    # Update metadata
cfstream video delete VIDEO_ID    # Delete video
cfstream link preview VIDEO_ID    # Preview URL
cfstream link signed VIDEO_ID     # Signed URL
cfstream link thumbnail VIDEO_ID  # Thumbnail URL
cfstream link hls VIDEO_ID        # HLS manifest
cfstream link dash VIDEO_ID       # DASH manifest
Embed
cfstream embed code VIDEO_ID      # Get iframe embed code

Output Formats

Use --output or -o to change the output format:

cfstream video list --output json   # JSON output
cfstream video list --output yaml   # YAML output
cfstream video list                 # Table output (default)

Global Flags

  • --output, -o - Output format (table, json, yaml)
  • --quiet, -q - Suppress non-essential output
  • --verbose, -v - Verbose output
  • --help, -h - Show help
  • --version - Show version

Examples

Upload and share workflow
# Upload
cfstream upload file presentation.mp4 --name "Q4 Presentation"

# Generate signed URL (24h expiry)
cfstream link signed abc123def456 --duration 24h

# Or get embed code
cfstream embed code abc123def456 --responsive
Batch operations with JSON
# Export all videos
cfstream video list --output json > videos.json

# Parse with jq
cfstream video get VIDEO_ID --output json | jq '.name'
Search and filter
# Find by name
cfstream video list --search "tutorial"

# Filter by status
cfstream video list --status ready --limit 50

Configuration

Configuration is loaded from (in order of precedence):

  1. Environment variables (CFSTREAM_*)
  2. Config file (~/.config/cfstream/config.yaml)
  3. Defaults
Environment Variables
  • CFSTREAM_ACCOUNT_ID - Cloudflare account ID
  • CFSTREAM_API_TOKEN - API token
  • CFSTREAM_OUTPUT - Default output format

Development

Run tests
go test ./...
Run linter
golangci-lint run
Build
go build -o cfstream

License

Unlicense

Documentation

Overview

Package main is the entry point for cfstream CLI.

Directories

Path Synopsis
Package cmd implements the CLI commands for cfstream.
Package cmd implements the CLI commands for cfstream.
internal
api
Package api provides a simplified wrapper around the Cloudflare Stream API.
Package api provides a simplified wrapper around the Cloudflare Stream API.
config
Package config manages configuration loading and persistence for cfstream CLI.
Package config manages configuration loading and persistence for cfstream CLI.
output
Package output provides formatting capabilities for CLI output.
Package output provides formatting capabilities for CLI output.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL