JS Zip is an open-source and free library to easily create Zip files without any pain which provides an easy and good API. You can use this library in your app to build easily Zip files. You can use this library when you want your users to download their data, like their images, their videos, their documents, and their other data.

You can download the package by:

With npm

npm install jszip

With bower

bower install Stuk/jszip

With component : 

component install Stuk/jszip

Manuallydownload JSZip and include the file dist/jszip.js or dist/jszip.min.js

Let’s create an example:

Import JSZIP:

var JSZip = require("jszip");

Create instance: 

var zip = new JSZip();

Basically, there are two main functions that make this open-source framework awesome, They are .file(name, content) and .folder(name). These methods return the instance of the functions so you can run the chains on it. Now let’s add a file to it:

zip.file("hello.txt", "Hello World");

Creating a folder

var photoZip = zip.folder("photos");

photoZip.file("README", "a folder with photos");

The above method will create a folder called photos that will save a file inside the photos folder. Here is an example demo: https://jsfiddle.net/c0jmn85o/4/.