How can I add a list of image files to a zip file using zip.js?

850 views Asked by At

I have a list of images and an HTML string which holds a web page containing the images. I would like to create a zipped file via JavaScript code by using zip.js and save it at runtime.

The creation of the htmlString to file.html was easy, but I'm not sure on how I can send this list of images to zip.js.

I thought to create dynamically via JavaScript a list of input file elements maybe via jQuery or something, but I still cannot figure out how to do it. Does there exist some way to do that?

1

There are 1 answers

0
or-yam On

If I understand correctly, you managed to create the list of files (array?) and your issue is to create the zip file that contains the files.

If this is the case you can try using this small package : https://www.npmjs.com/package/list-to-zip

It accept an array of urls and create a zip file from it.