multiple-images-uploader
TypeScript icon, indicating that this package has built-in type declarations

0.4.1 • Public • Published

Multiple images uploader

Simple uploader for tons of images

Features

  • Multistream upload
  • Stop/pause, resuming previous upload
  • Promise & events support
  • Configurable chunk size

Installing

npm install multiple-images-uploader

Examples

const filesToUpload = form.elements.files;
 
const uploader = new MultipleUploader({
  target: 'http://example.com/upload',
  files: filesToUpload
});
 
// Subscribe for progress
uploader.on('progress' (event) => console.log(event));
// will print {total: 51255, loaded: 12234, percent: '23%'}
 
uploader.start()
  .then(() => console.log('success!'));
  .catch((e) => console.log('e'));
 
// Also you can subsribe 
uploader.on('finish', () => ...);
uploader.on('error'), (error) => ...);

Constructor options argument

{
  target: 'localhost'   // request target,
  files: files          // accept <FileList> type
  additData: [          // data to be sent with each part
    {
    key: 'login',
    value: 'boroda'
    }
  ]
  partSize: 5           // each part will contain n files. Default: 5
  streams: 2            // number of concurrent requests. Default: 1.
}

Readme

Keywords

none

Package Sidebar

Install

npm i multiple-images-uploader

Weekly Downloads

1

Version

0.4.1

License

ISC

Unpacked Size

14.8 kB

Total Files

13

Last publish

Collaborators

  • enity