@fatcherjs/middleware-progress
v3.0.0
Published
<div align="center"> <a href="https://codecov.io/github/fatcherjs/middleware-progress" > <img src="https://codecov.io/github/fatcherjs/middleware-progress/graph/badge.svg?token=JZ22RH00S5"/> </a> <a href="https://www.jsdelivr.com/package/npm/@f
Downloads
107
Readme
@fatcherjs/middleware-progress
Install
NPM
>$ npm install @fatcherjs/middleware-progressCDN
<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
},
});