WPB Upload CLI - Upload Large Backups via Command Line
Uploading large WordPress backup files through a browser can be frustrating. Browser timeouts, server upload limits, and network interruptions often cause failuresβespecially with multi-gigabyte backups. WPB Upload CLI solves this problem by providing a robust command-line tool that handles large file uploads reliably.
The Problem with Browser Uploads
Traditional browser-based uploads face several limitations:
- File Size Limits: Most servers restrict upload sizes (often 2-10MB via
upload_max_filesize) - Timeout Issues: Large files take too long, exceeding PHP's
max_execution_time - Network Interruptions: Browser uploads can't resume if the connection drops
- No Progress Tracking: Difficult to monitor upload progress for large files
- Memory Constraints: Loading entire files into memory causes PHP memory exhaustion
For large WordPress sites with extensive media libraries, these limitations make browser uploads impractical.
Introducing WPB Upload CLI
WPB Upload CLI is a Node.js command-line tool designed specifically for uploading large backup files to WordPress sites running the Worry Proof Backup plugin (version 0.2.0 or higher). It uses chunked uploads, parallel processing, and automatic restore to handle files of any size.
Key Features
- π¦ Chunked Uploads: Automatically splits large files into manageable chunks
- β‘ Parallel Processing: Uploads multiple chunks concurrently for faster transfers
- π Progress Tracking: Real-time progress bar showing upload status
- π Auto-Restore: Automatically triggers the unzip/restore process after upload
- π Secure Authentication: Uses WordPress Application Passwords for secure access
- π‘οΈ Error Handling: Robust error handling with retry logic
Installation
Using npx (Recommended - No Installation Required)
The easiest way to use WPB Upload CLI is with npx, which runs the tool without installing it globally:
npx github:miketropi/wpb-upload-cli upload --file <path> --site <url> --token <token>
This approach:
- Requires no installation
- Always uses the latest version
- Keeps your system clean
Global Installation (Optional)
If you use the tool frequently, you can install it globally:
npm install -g github:miketropi/wpb-upload-cli
Then use it directly:
wpb-upload-cli upload --file <path> --site <url> --token <token>
Prerequisites
Before using WPB Upload CLI, ensure you have:
- Node.js installed (ES modules support required)
- Worry Proof Backup plugin version 0.2.0 or higher installed and activated on your WordPress site
- WordPress Application Password created for authentication
Note: The chunked upload feature is available starting from Worry Proof Backup version 0.2.0. If you're using an older version, please update the plugin first.
Creating a WordPress Application Password
- Go to your WordPress admin dashboard
- Navigate to Users β Your Profile
- Scroll down to Application Passwords
- Enter a name (e.g., "CLI Upload Tool")
- Click Add New Application Password
- Copy the generated password (format:
xxxx xxxx xxxx xxxx xxxx xxxx)
Important: Store this password securelyβyou won't be able to see it again.
Usage
Basic Command Structure
npx github:miketropi/wpb-upload-cli upload \
--file <path-to-backup.zip> \
--site <wordpress-site-url> \
--token "username:application_password"
Required Options
--file <path>: Path to the backup ZIP file you want to upload--site <url>: Your WordPress site URL (e.g.,https://example.com)--token <token>: Authentication token in format"username:application_password"
Optional Options
--chunk-size <mb>: Chunk size in megabytes (default:10)--concurrency <n>: Number of parallel uploads (default:3)
Examples
Example 1: Basic Upload
Upload a standard backup file:
npx github:miketropi/wpb-upload-cli upload \
--file ./backup-2026-01-06.zip \
--site https://mysite.com \
--token "admin:abcd efgh ijkl mnop qrst uvwx"
Example 2: Large File with Custom Chunk Size
For very large files (5GB+), increase chunk size for efficiency:
npx github:miketropi/wpb-upload-cli upload \
--file ./large-backup-15gb.zip \
--site https://mysite.com \
--token "admin:abcd efgh ijkl mnop qrst uvwx" \
--chunk-size 20 \
--concurrency 5
Example 3: Slow Connection Optimization
For slower connections, use smaller chunks and lower concurrency:
npx github:miketropi/wpb-upload-cli upload \
--file ./backup.zip \
--site https://mysite.com \
--token "admin:abcd efgh ijkl mnop qrst uvwx" \
--chunk-size 5 \
--concurrency 2
Example 4: Automated Backup Script
Integrate into shell scripts for automated workflows:
#!/bin/bash
BACKUP_FILE="/backups/site-backup-$(date +%Y%m%d).zip"
SITE_URL="https://mysite.com"
TOKEN="admin:abcd efgh ijkl mnop qrst uvwx"
npx github:miketropi/wpb-upload-cli upload \
--file "$BACKUP_FILE" \
--site "$SITE_URL" \
--token "$TOKEN" \
--chunk-size 15 \
--concurrency 4
if [ $? -eq 0 ]; then
echo "Upload successful!"
else
echo "Upload failed!"
exit 1
fi
How It Works
1. File Chunking
The tool reads your backup file and splits it into chunks based on the specified chunk size:
backup.zip (2GB)
βββ chunk-0 (10MB)
βββ chunk-1 (10MB)
βββ chunk-2 (10MB)
βββ ... (200 chunks total)
2. Parallel Upload
Chunks are uploaded concurrently to the WordPress REST API endpoint:
POST /wp-json/worry-proof-backup/v1/upload-chunk
The tool manages a queue of uploads, maintaining the specified concurrency level.
3. Progress Tracking
A real-time progress bar shows:
Uploading: [ββββββββββββββββββββββββ] 75% (150/200 chunks)
4. Automatic Restore
Once all chunks are uploaded, the tool automatically triggers the restore process:
POST /wp-json/worry-proof-backup/v1/restore-start
POST /wp-json/worry-proof-backup/v1/restore-run
The server reassembles the chunks, extracts the ZIP file, and restores your site.
API Endpoints
WPB Upload CLI communicates with these WordPress REST API endpoints:
| Endpoint | Method | Purpose |
|---|---|---|
/wp-json/worry-proof-backup/v1/upload-chunk |
POST | Upload individual file chunks |
/wp-json/worry-proof-backup/v1/restore-start |
POST | Initialize restore process |
/wp-json/worry-proof-backup/v1/restore-run |
POST | Execute restore process |
All endpoints require WordPress authentication via Application Passwords.
Error Handling
Common Errors and Solutions
413 Payload Too Large
Error: Request Entity Too Large
Solution: Reduce the --chunk-size option:
--chunk-size 5 # Use smaller chunks
Authentication Failed
Error: 401 Unauthorized
Solution: Verify your Application Password format:
--token "username:application_password" # Correct format
Network Timeout
Error: ETIMEDOUT or connection errors
Solution:
- Check your internet connection
- Reduce
--concurrencyto lower parallel load - Use smaller
--chunk-sizefor slower connections
File Not Found
Error: ENOENT: no such file or directory
Solution: Verify the file path is correct and the file exists:
ls -lh ./backup.zip # Verify file exists
Best Practices
1. Choose Appropriate Chunk Sizes
- Fast connections: 15-20MB chunks
- Standard connections: 10MB chunks (default)
- Slow connections: 5MB chunks
2. Adjust Concurrency
- High bandwidth: 4-5 parallel uploads
- Standard bandwidth: 3 parallel uploads (default)
- Low bandwidth: 1-2 parallel uploads
3. Monitor Progress
Watch the progress bar for issues. If uploads stall:
- Check network connectivity
- Verify server is responding
- Review WordPress error logs
4. Test on Staging First
Always test large uploads on a staging site before production:
npx github:miketropi/wpb-upload-cli upload \
--file ./backup.zip \
--site https://staging.mysite.com \
--token "admin:token"
5. Secure Your Tokens
Never commit Application Passwords to version control. Use environment variables:
export WP_TOKEN="admin:application_password"
npx github:miketropi/wpb-upload-cli upload \
--file ./backup.zip \
--site https://mysite.com \
--token "$WP_TOKEN"
Use Cases
1. Large Site Migrations
Move large WordPress sites between servers without browser limitations:
# Create backup on source server
# Transfer backup.zip to new server
# Upload via CLI
npx github:miketropi/wpb-upload-cli upload \
--file ./migration-backup.zip \
--site https://newsite.com \
--token "admin:token"
2. Automated Backup Workflows
Integrate into CI/CD pipelines or scheduled backup scripts:
# Daily backup script
0 2 * * * /path/to/backup-script.sh
3. Server-to-Server Transfers
Upload backups directly from one server to another:
# On backup server
scp backup.zip user@wordpress-server:/tmp/
ssh user@wordpress-server "npx github:miketropi/wpb-upload-cli upload --file /tmp/backup.zip --site https://mysite.com --token 'admin:token'"
4. Development Environment Setup
Quickly restore production backups to development environments:
npx github:miketropi/wpb-upload-cli upload \
--file ./production-backup.zip \
--site https://dev.mysite.com \
--token "dev-admin:token"
Performance Comparison
Browser Upload vs CLI Upload
| Aspect | Browser Upload | WPB Upload CLI |
|---|---|---|
| Max file size | 2-10MB (server limit) | Unlimited (chunked) |
| Timeout handling | β Fails on timeout | β Resumable chunks |
| Progress tracking | β οΈ Limited | β Real-time progress |
| Network efficiency | β οΈ Single connection | β Parallel uploads |
| Automation | β Manual only | β Scriptable |
| Error recovery | β Must restart | β Retry failed chunks |
Technical Details
Dependencies
WPB Upload CLI uses:
- axios: HTTP client for API requests
- commander: CLI framework for argument parsing
- form-data: Multipart form data handling
- p-queue: Promise queue for managing concurrent uploads
- cli-progress: Progress bar display
Architecture
βββββββββββββββββββ
β backup.zip β
β (Large File) β
ββββββββββ¬βββββββββ
β
βΌ
βββββββββββββββββββ
β File Reader β
β (Chunking) β
ββββββββββ¬βββββββββ
β
βΌ
βββββββββββββββββββ
β Upload Queue β
β (Parallel) β
ββββββββββ¬βββββββββ
β
βΌ
βββββββββββββββββββ
β WordPress API β
β (REST) β
ββββββββββ¬βββββββββ
β
βΌ
βββββββββββββββββββ
β Auto Restore β
β (Trigger) β
βββββββββββββββββββ
Security Considerations
- Application Passwords: Use WordPress Application Passwords, not your main admin password
- HTTPS Only: Always use HTTPS for site URLs
- Token Storage: Never commit tokens to version control
- Permissions: Only users with
manage_optionscapability can use the REST API endpoints - Network: Use secure networks when uploading sensitive backups
Troubleshooting
Upload Stalls
If uploads stop progressing:
- Check network connectivity
- Verify WordPress site is accessible
- Review server error logs
- Try reducing concurrency:
--concurrency 1
Chunk Upload Failures
If specific chunks fail:
- The tool will report which chunk failed
- Retry the upload (failed chunks will be re-uploaded)
- Check server logs for specific errors
- Verify PHP memory limits are sufficient
Restore Not Triggering
If upload completes but restore doesn't start:
- Verify Worry Proof Backup plugin version 0.2.0 or higher is installed
- Check WordPress REST API is enabled
- Verify Worry Proof Backup plugin is active
- Review plugin logs in WordPress admin
- Manually trigger restore from WordPress admin
Conclusion
WPB Upload CLI solves the problem of uploading large WordPress backup files by leveraging chunked uploads, parallel processing, and automatic restore. Whether you're migrating sites, setting up development environments, or automating backup workflows, this tool provides a reliable, scriptable solution.
Key Benefits:
- β Handle files of any size
- β Faster uploads with parallel processing
- β Reliable with error handling
- β Automated restore process
- β Perfect for CI/CD and automation
Get started today by installing WPB Upload CLI and experience worry-free large file uploads.
Ready to upload large backups? Install WPB Upload CLI or download Worry Proof Backup v0.2.0+ for your WordPress site.