Javascript

Zip files on Client Side

You can make zip file with contents in javascript easily.

var zip = new JSZip();
zip.file(“Hello.txt”, “Hello World”);
var dir = zip.folder(“images”);
dir.file(“smile.gif”, imgData, {base64: true});
zip.generateAsync({type:”blob”})
.then(function(content) {
saveAs(content, “example.zip”);
});

This code will download zip file in browser, tick,,,
Please use this lib for frontend side zip file generation.

Reference: https://stuk.github.io/jszip/

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *