How to create zip files using javascript

I found a javascript plugin that could generate zip files called jszip: http://jszip.stuartk.co.uk/

I tried, but I think that it can only generate files that will be compiled in a zip file. I want to be able to add existing files to the zip file that it will generate. Is this possible in javascript?

+4
source share
1 answer

Scroll down to the "Documentation" section on the page you linked to. It describes how to add files to a zip file. For binaries, you end up using base64, it seems. For text files, you can transfer them directly as strings. Of course, you will need access to the data files to add them to the zip file, which is quite simple if you, say, extract the mentioned data in an Ajax request, but uphill if you want the user to be able to archive files from their local storage.

+5
source

Source: https://habr.com/ru/post/1379249/


All Articles