Skip to main content
Version: 4.x.x

Request Progress

With the the onDownloadProgress and onUploadProgress methods available on the useFetch you can get parsed and prepared to display values of the estimated time for finalizing the request download or upload.

It will return you the percentage value of the request progress, estimated time left to the end of the task and size of it that left to be uploaded or downloaded in bytes.


Example

const { data, error, loading, onDownloadProgress, onUploadProgress } = useFetch(getFile);

onDownloadProgress((progress) => {
console.log(payload); // { progress, timeLeft, sizeLeft }
});

onUploadProgress((progress) => {
console.log(payload); // { progress, timeLeft, sizeLeft }
});