New Features
⭐ Progress Tracking
Real-time upload and download progress monitoring with automatic XMLHttpRequest switching.
Z-Fetch provides powerful progress tracking capabilities for both uploads and downloads, automatically switching to XMLHttpRequest when progress callbacks are provided.
How It Works
When you provide onUploadProgress or onDownloadProgress callbacks, Z-Fetch automatically:
- Switches to XMLHttpRequest for progress support
- Maintains full API compatibility with fetch
- Provides real-time progress events with loaded/total bytes
- Falls back to fetch when no progress callbacks are needed
- Respects
withCredentials: setsxhr.withCredentials = truewhen configured - Supports cancellation: abort via the cancelable promise or
result.cancelRequest()Smart Implementation
Z-Fetch automatically chooses the best transport method based on your needs
- XMLHttpRequest for progress, fetch for everything else.
Upload Progress
Track file upload progress in real-time:
Download Progress
Monitor download progress for large files:
Cancellation
Combined Upload & Download
Track both upload and download phases:
Real-World Examples
Image Upload with Preview
Large File Download with Resume
Progress Event Properties
The progress event object contains:
Instance-Level Progress
Set default progress handlers for all requests:
Helper Functions
Related Features
Progress tracking works seamlessly with other Z-Fetch features:
- 🟡 Streaming Support - Combine progress tracking with streaming for large file operations
- 🚨 Error Handling - Comprehensive error handling for upload/download operations
- 💪 Using Hooks - Enhanced hooks system for request lifecycle management
- 👉 Request Methods - All HTTP methods support progress tracking capabilities