Just call zip.file() .
Look at the example on the documentation page (my comments):
var zip = new JSZip(); // Add a text file with the contents "Hello World\n" zip.file("Hello.txt", "Hello World\n"); // Add a another text file with the contents "Goodbye, cruel world\n" zip.file("Goodbye.txt", "Goodbye, cruel world\n"); // Add a folder named "images" var img = zip.folder("images"); // Add a file named "smile.gif" to that folder, from some Base64 data img.file("smile.gif", imgData, {base64: true}); var content = zip.generate(); location.href="data:application/zip;base64,"+content;
It is important to understand the code that you wrote - to find out what each line does. If you do this, you will realize that you just need to call zip.file() again to add another file.
source share