Upload and download progress tracking plugin for Spoosh via XHR transport.
Documentation · Requirements: TypeScript >= 5.0 · Peer Dependencies: @spoosh/core
npm install @spoosh/plugin-progress
import { Spoosh } from "@spoosh/core";
import { progressPlugin } from "@spoosh/plugin-progress";
const spoosh = new Spoosh<ApiSchema, Error>("/api").use([progressPlugin()]);
// Enable per-request
useRead((api) => api("files/:id").GET(), { progress: true });
// File upload with progress
const { trigger, meta } = useWrite((api) => api("files").POST(), {
progress: true,
});
trigger({ body: form({ file: selectedFile }) });
// Access progress via meta.progress
| Option |
Type |
Description |
progress |
boolean | ProgressOptions |
Enable progress tracking. Automatically uses XHR transport. |
| Option |
Type |
Description |
totalHeader |
string |
Response header to read total size from when Content-Length is unavailable |
| Field |
Type |
Description |
loaded |
number |
Bytes transferred so far |
total |
number |
Total bytes (0 if unknown) |