1.0.2 • Published 2 years ago

downloader-with-progress v1.0.2

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

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();