New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

zip-downloader

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zip-downloader

This can be used to download multiple files bundled into one or more zip files

latest
Source
npmnpm
Version
1.0.2
Version published
Weekly downloads
10
Maintainers
1
Weekly downloads
 
Created
Source

zip-downloader

Zip-downloader can be used to download multiple files bundled into one or more zip files.

You can give zip-downloader an array of assets to download and it can download them internally and bundle them in zip(s) and download the final zip(s).

Test it out here: http://bit.ly/zip-downloader

Options that you can pass

downloadFileName (String) - Name of the zipped file downloaded.

Default: zipped_files

maxZIPSize (Integer) - Maximum size of the zip file downloaded. If total downloaded file size increases this, it will be split into multiple zips.

Default: 2000000000 (2GB). The maximum possible value for maxZIPSize is 2GB as of now.

downloadBigFiles (Boolean) - If false, files greater than maxZIPSize are not downloaded. If true, those files are downloaded separately.

Default: true

statusCallback (Function) - This function is called whenever the download status changes for any file being downloaded. It can be used to update the download status. It is passed the count of downloaded assets till that moment.

onComplete (Function) - This is called on completion of the download. When it is called, it is passed a summary object of the download. That object contains -

  • numberOfDownloadedAssets
  • numberOfFailedAssets
  • numberOfLargeUnZippedAssets
  • numberOfDownloadedZIPFiles
  • failedAssetList - array of data of assets for which download failed.

Usage example


import downloader from 'zip-downloader'; 
 
var assets = [
    {
        src, //src of the asset (image, video, pdf, anything)
        name, // name of the downloaded file for this asset (optional)
    }
];

var options = {
    downloadFileName: 'zipped',
    statusCallback: function(downloadedTillNow){
        console.log('Download status:' + ((downloadedTillNow * 100)/assets.length));
    },
    onComplete = function(downloadedSummary){
        console.log('Assets downloaded:' + downloadedSummary.numberOfDownloadedAssets);
        console.log('Assets failed:' + downloadedSummary.numberOfFailedAssets);
        console.log('Large Assets downloaded(over maxZIPSize):' + downloadedSummary.numberOfLargeUnZippedAssets);
        console.log('Number of zip files downloaded:' + downloadedSummary.numberOfDownloadedZIPFiles);
        console.log('Array of failed assets:');
        console.log(downloadedSummary.failedAssetList);
    },
};

downloader(assets, options);

Limits

Using this we can only download zip files of maximum 2GB. This is a limitation as of now. But we can work towards fixing it.

License

MIT

Keywords

download

FAQs

Package last updated on 08 May 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts