@building-block/track-progress
v1.0.0-alpha.4
Published
Track progress, bitrate (speed), remaining time from XHR upload & download events
Downloads
99
Readme
track-progress
Track progress, bitrate (speed), remaining time from XHR upload & download events
Installation
Using npm:
$ npm install --save @building-block/track-progress
Using yarn:
$ yarn add @building-block/track-progress
Usage
import xhrFetch from '@building-block/xhr-fetch';
import { createProgressTracker, fromXHREvent } from '@building-block/track-progress';
const trackUploadProgress = createProgressTracker();
response = await xhrFetch('/upload', {
method: 'PUT',
/* ... */
onUploadProgress: xhrEvent => {
const stats = trackUploadProgress(fromXHREvent(xhrEvent));
/* ... */
},
});
Try with Runkit