2.0.0 • Published 2 years ago

@fatcherjs/middleware-progress v2.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

@fatcherjs/middleware-progress

A Middleware for getting progress

Install

NPM

>$ npm install @fatcherjs/middleware-progress

CDN

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

Usage

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

fatcher({
    url: '/bar/foo',
    middlewares: [
        progress({
            onDownloadProgress: (current, total) => {
                console.log(current / total);
            },
        }),
    ],
    payload: {
        bar: 'foo',
    },
})
    .then(res => {
        console.log(res);
    })
    .catch(err => {
        console.error(error);
    });

Options

NameDescriptionTypeDefaultValue
onDownloadProgressCallback with read stream chunks((current: number, total: number) => void) \| nullnull
lengthNameCustom name in headers withcontent-length|string|'content-length'`

License

MIT

1.7.2

2 years ago

1.8.0

2 years ago

2.0.0

2 years ago

1.7.1

2 years ago

1.7.0

2 years ago

1.6.1

2 years ago

1.6.0

2 years ago

1.5.0

2 years ago

1.4.1

2 years ago

1.4.0

2 years ago

1.3.0

2 years ago

1.2.0

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago