downloader-with-progress

1.0.2 • Public • Published

Javascript Download File With Progress

    import Downloader from 'downloader-with-progress';
    
    let url = 'http://cachefly.cachefly.net/100mb.test';
    let dl = new Downloader(url);
    dl.onProgress((percent, loaded, total) => {
        console.log('percent: ' + percent, 'loaded: ' + loaded, 'total: ' + total);
    })
    .onChangeState((state) => {
        console.log('state', state);
    })
    .onFinish((blobUrl) => {
        console.log('finshed', blobUrl)
        dl.save('filename.ext'); // Save File
    })
    .start();
    
    // OR 
    
    dl.abort(); 
    

Package Sidebar

Install

npm i downloader-with-progress

Weekly Downloads

0

Version

1.0.2

License

ISC

Unpacked Size

3.92 kB

Total Files

3

Last publish

Collaborators

  • javadimohammad