fetchWithProgress
function fetchWithProgress(input, init?): Promise<Response>;Defined in: fetch-with-progress.ts:45
Drop-in fetch replacement that adds upload/download progress tracking.
Compatible with Eden Treaty’s fetcher option.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
input |
RequestInfo | URL |
init? |
FetchWithProgressInit |
Returns
Section titled “Returns”Promise<Response>
Example
Section titled “Example”const client = treaty<App>(url, { fetcher: fetchWithProgress as typeof fetch, fetch: { credentials: "include" },});
// With progress:await client.api.upload.post(formData, { onProgress: ({ direction, transferred, total }) => { console.log(`${direction}: ${transferred}/${total}`); },});