fetch-api-progress
Version:
Upload and download progress for Fetch API
13 lines (12 loc) • 805 B
TypeScript
import { type FetchProgressEvent } from "./createProgressEvent";
/**
* Function that tracks the body download progress of a fetch response. It takes a `Response` object and a callback
* function as arguments. The callback function is called with a `FetchProgressEvent` object whenever the progress
* changes.
*
* @param {Response} response - The fetch response to track.
* @param {(arg0: FetchProgressEvent) => void} onProgress - The callback function to call with the progress event.
* @returns {Response} - A new response object that uses a readable stream, or the original response object if readable
* streams are not supported, or the response carries no body.
*/
export declare function trackResponseProgress(response: Response, onProgress: (arg0: FetchProgressEvent) => void): Response;