Good morning, I am using JSZip to create a zip, I have this code:
for (var i = 0, f; f = content[i]; i++) {
var zip = new JSZip();
zip.file(f.name, f);
zip.generateAsync({type:"blob", compression:"DEFLATE", compressionOptions: { level: 9 }})
.then(function(content) {
var item = {
'type' : content.type,
'size' : content.size,
//'name' : ¿content.name?
}
});
}
I do not want to download the file, I want to upload it to my server, but it does not have an attribute name, it has two attributes: type and size. But I need to set a name to the file.
It does not work if I write 'name' : f.name, because the function is async.
Do someone know how to pass the attributte name to content.
Edit: or, if you can tell me how to make it not async, that will work too.
Thanks for help.