Cap upload bandwidth via maxUploadBytesPerSecond
One option, no plugin. Set maxUploadBytesPerSecond and the chunked uploader gates each chunk through a rolling 1-second token bucket so the average outgoing rate stays at or below the cap. Useful for being a good citizen on shared infrastructure, throttling background uploads behind interactive ones, or staying under per-IP limits at the load balancer.
Applies to the chunked strategy. Direct-to-cloud strategies (s3/azure/gcs) bypass your server and are intentionally unthrottled.
Try it: pick a cap, queue a multi-megabyte file, hit upload, and watch the speed indicator hover near the cap. Switch to "No cap" and the same file finishes ~5-50x faster.
Configuration
new MultipleUpload('#uploader', {
uploadUrl: '/api/upload',
chunked: true,
chunkSize: 256 * 1024,
maxUploadBytesPerSecond: 256 * 1024 // 256 KB/s cap
});How it works
- The uploader keeps a rolling 1-second window of recent chunk timestamps + sizes.
- Before dispatching each chunk, it sums the window. If
sum + chunkSize > cap, it sleeps just long enough to bring the rate back under (max 2-second sleep per chunk). - Sleeps respect cancel / pause - aborted tasks don't accumulate dead promises.
- Throttle state is per-uploader, not global - multiple uploaders on the page run independently.
Hooks for custom strategies
Custom strategies registered via registerStrategy can opt in by calling uploader._waitForBandwidth(chunkSize) before dispatching:
MultipleUpload.registerStrategy('my-transport', {
upload: async function (task, uploader) {
for (const chunk of slice(task.file)) {
await uploader._waitForBandwidth(chunk.size);
await fetch('/my-endpoint', { method: 'POST', body: chunk });
}
}
});Use cases
- Background sync: low cap when the user is interactively working in the same app, lift it when the tab is idle.
- Dev-host friendly: 1 MB/s cap during local development to mimic real-world WAN.
- Mobile-friendly defaults: detect
navigator.connection?.saveDataand set a low cap for users on metered connections. - Fairness: when a single user uploads many files in parallel, cap each one so the queue progresses smoothly instead of one giant file dominating.
None of Uppy, FilePond, Dropzone, or FineUploader expose a built-in bandwidth cap. This is unique to MultipleUpload.