Skip to content

fatcherjs/middleware-progress

Repository files navigation

@fatcherjs/middleware-progress

Install

NPM

>$ npm install @fatcherjs/middleware-progress

CDN

<script src="https://cdn.jsdelivr.net/npm/fatcher/dist/fatcher.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@fatcherjs/middleware-progress/dist/index.min.js"></script>

<script>
  Fatcher.fatcher('url', {
    middlewares: [FatcherMiddlewareProgress],
    onDownloadProgress: (current, total) => {
      // process progress
    },
  }).then(response => {
    console.log(response);
  });
</script>

Usage

import { fatcher } from 'fatcher';
import { progress } from '@fatcherjs/middleware-progress';

fatcher('https://foo.bar', {
  middlewares: [progress],
});

Options

onDownloadProgress

import { fatcher } from 'fatcher';
import { progress } from '@fatcherjs/middleware-progress';

fatcher('https://foo.bar', {
  middlewares: [progress],
  onDownloadProgress: (current, total) => {
    // current received data length
    // total data length
  },
});

License

MIT

About

@fatcherjs/middleware-progress

Resources

License

Stars

Watchers

Forks

Packages

No packages published