There is an ideal plugin for creating ZIP files inside the browser.
JSZip: https://stuk.imtqy.com/jszip/
Install the plugin by adding js files manually:
download JSZip and include the dist / jszip.js or DIST / jszip.min.js file
JSFiddle - JSZip 3.0:
https://jsfiddle.net/andrebonna/u8zsbzau/
var zip = new JSZip();
for (var i = 0; i < 5; i++) {
var CSV = 'CSV_content';
zip.file("file" + i + ".csv", CSV);
}
zip.generateAsync({
type: "base64"
}).then(function(content) {
window.location.href = "data:application/zip;base64," + content;
});