Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@building-block/track-progress

building-block81MIT1.0.0-alpha.4TypeScript support: included

Track progress, bitrate (speed), remaining time from XHR upload & download events

XHR, XMLHttpRequest, fetch, upload, download, stats, progress, react, bitrate, byte, speed, metrics, percentage, percent, time remaining, elapsed time, uploader, abortable, abortable fetch, progression

readme

track-progress

Track progress, bitrate (speed), remaining time from XHR upload & download events

NPM Gzip Size

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