[SOLVED] jsZip adding photos

I have a Photos collection and the schema is as follows

{
  data: base64data,
  caption: string,
  form_id: string
}

Now I want to put the images into a ZIP file for download, so I’ve added the npm package jszip, and the pfafman:filesaver meteor package.

I add the files like this:

let photos = Photos.find({form_id: e._id}).fetch();
if(photos) {
  photos.forEach(function(photo) {
    archive.folder('photos').folder(e.name).file(photo.name+".jpg", photo.data, {base64: true});
   });
}

The archive has the proper folder structure, and has a jpg image in there, but the image has no data. Please help if you can. I’m not sure why the image has no data.

for whatever reason the following adjustment worked:

archive.folder('photos').folder(e.name).file(photo.name+".jpg", photo.data[0], {base64: true});