jszip
jszip copied to clipboard
how to retrieve file (like the fileAPI blob) from a folder inside a readed zip?
I have a zip (2 txt files and 1 folder with 3 images) that I want to read/load, say mybox.zip:
- mybox.zip
- myfile1.txt
- myfile2.txt
- myfolder
- myimage1.jpg
- myimage2.jpg
- myimage3.jpg
I want to retrieve the three images...
I use:
var fileReader = new FileReader();
fileReader.onload = function(e) {
var zip = new JSZip(e.target.result);
$.each(zip.files, function (index, zipEntry) {
console.log(zipEntry);
if (zipEntry.dir) {
console.log(zipEntry.name + ' is a folder!!');
// iterate inside this folder....
});
}
}