@building-block/track-progress
TypeScript icon, indicating that this package has built-in type declarations

1.0.0-alpha.4 • Public • Published

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

/@building-block/track-progress/

    Package Sidebar

    Install

    npm i @building-block/track-progress

    Weekly Downloads

    6

    Version

    1.0.0-alpha.4

    License

    MIT

    Unpacked Size

    72.8 kB

    Total Files

    10

    Last publish

    Collaborators

    • juliaqiuxy
    • jmurzy