Skip to content
Advertisement

Javascript create zip file

I am developing a website using react.js and admin-on-rest. One feature is allowing users to upload a pdf file.

I get the file as type FILE and want to get the file from FILE, compress it to zip, and then make it to type FILE.

So it should be FILE -> origin file -> zip file -> FILE from zip file.

I tried JSZip but still can not figure it out.

Any help is appreciated. Thanks

Advertisement

Answer

Hi Garrick following are the steps you need to take.

1) handle fileupload in a rest wrapper https://marmelab.com/admin-on-rest/RestClients.html#decorating-your-rest-client-example-of-file-upload

the above example is for image upload. But you will essentially be doing the same thing.

2)

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement