zip name:testing.zip
when i am extracting am getting the files testing\https_\s3-us-west-2.amazonaws.com\files\image.jpg
expected structure :testing/image.jpg
here is my code
var urls = ['https://s3-us-west-2.amazonaws.com/files/image.jpg'];
var nombre = $scope.meetingName;
//The function is called
compressed_img(urls, nombre);
function compressed_img(urls, nombre) {
var zip = new JSZip();
var count = 0;
var name = nombre + ".zip";
urls.forEach(function (url) {
JSZipUtils.getBinaryContent(url, function (err, data) {
if (err) {
throw err;
}
zip.file(url, data, { binary: true });
count++;
if (count == urls.length) {
zip.generateAsync({ type: 'blob' }).then(function (content) {
saveAs(content, name);
});
}
});
});
}
finally here is the working code
zip.file(url, data, { binary: true });
replaced by
var filename = url.replace(/.*\//g, "");
zip.file(filename, data, { binary: true, createFolders: true });