Method Signature
Parameters
Backup configuration options
Returns
Handle representing the stored backup
Example
Example: Checkpoint Pattern
Example: Periodic Backups
Configuration Requirements
Backups require R2 configuration in your Worker:Error Handling
Throws an error if:- Directory does not exist
- Insufficient disk space for compression
- R2 upload fails
- R2 is not configured
- Directory is too large
Technical Details
- Backups use SquashFS compression for efficient storage
- Compression happens in the container
- Upload to R2 uses presigned URLs for direct transfer
- Backup process is serialized to prevent concurrent operations
- Large directories may take time to compress and upload
Notes
- Backups are stored in R2 and incur storage costs
- TTL starts when the backup is created
- Expired backups are automatically deleted by R2
- Backup handles are serializable - store them in KV, DO, or return to clients
- Symlinks are preserved but their targets must be within the backed-up directory
- File permissions and ownership are preserved
See Also
- restoreBackup - Restore a backup
- Backups Guide - Learn about backup strategies