I'm trying to understand why the zip.files[filename].async('blob') isn't being added to the promises list in the code below. When I check console.log(data.length), it always shows 0. Can anyone help me figure out what's going wrong?
const promises = [];
var jsZip = require('jszip');
jsZip.loadAsync(file.object).then(function (zip) {
Object.keys(zip.files).forEach(function (filename) {
promises.push(zip.files[filename].async('blob'));
console.log(promises.length);
})
});
Promise.all(promises).then(function(data){
console.log(data.length);
});