dimanche 1 septembre 2019

how to zip local folder and download it?

i need to compress a local folder in order for the user to download it, this folder is a small web page with sub folders and images in it.

What i need to do is:

1.- Create a text file (i already have this) 2.-Compress the folder that i want with the text file that i already created (this is where im stuck)

i tried with jszip-utils but it wont work.

function descargaPlantilla(){
    let zip = new JSZip();
     var filename = "imagenes.html";

    var blob = new Blob([result], {
        type: "text/plain;charset=utf-8"
    });

    saveAs(blob, filename);  


    SZipUtils.getBinaryContent("/Users/ricardowallacelimon/E4", function (err, data) {
        if (err) {
            throw err; // or handle the error
        }
        zip.file("/Users/ricardowallacelimon/E4", data, { binary: true });
    });




}

i get these errors:

TypeError: global.JSZipUtils is undefinedjszip-utils-ie.js:36:1ReferenceError: SZipUtils is not defined4 cenidet.js:180:5

ReferenceError: SZipUtils is not defined



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire