cs_file_downloads_frontend

1.0.2 • Public • Published

CSFileDownloadFrontend

Description:

Module for downloading multiple files in chunks. Use it if you need to pause your downloads. See backend implementation https://www.npmjs.com/package/cs_file_downloads_backend

How to use:

Install:
npm i cs_file_downloads_frontend
Import CSDownload to your app:
import {CSDownload} from './node_modules/cs_file_downloads_frontend/CSDownload'
Configure CSDownload:
CSDownload.config({
  'chunkSize': 1 * 1024 * 1024,
  'concurrentRequests': 3,
  'url': 'http://localhost:3000/',
  'repeat': true,
  'repeatCount': 5,
});
Download File:
// download function checks if a file exists on server
// returns singleFile object, a file currently downloading
let singleFile =  CSDownload.download(file);
singleFile functions:
singleFile.pause() // pauses upload of a file
singleFile.continue() // continues upload of a file
Progress listener:
singleFile.eventEmitter.on('progress', (progress)=>{
    // do something
})
Error listener:
singleFile.eventEmitter.on('error', (message)=>{
    // do something
})
Use webpack to bundle your files:
webpack main.js

Package Sidebar

Install

npm i cs_file_downloads_frontend

Weekly Downloads

3

Version

1.0.2

License

ISC

Unpacked Size

9.94 kB

Total Files

6

Last publish

Collaborators

  • mislav.clover