Stuk / jszip

Create, read and edit .zip files with Javascript
https://stuk.github.io/jszip/
Other
9.75k stars 1.3k forks source link

send a large zip file through ajax but after validating each file from zip #493

Open preranaB opened 6 years ago

preranaB commented 6 years ago

I want to send a large zip file approx. 256 MB through AJAX call to the service. But before sending the file I have to validate each file contained in the zip against parameters such as file size, file format(whether it is a valid image file) and image dimensions in each file. Do I need to use streaming mechanism to send 256 MB file? If yes, how can I achieve it with validations in place for each file using JSZip?

jimmywarting commented 6 years ago

If you are reading and validating a existing zip file without manipulate the content then it's quite easy.

You are just going to iterate over all files and validate them. There is no need to generate a new zip and take up approx 256MB extra RAM (since u already have a zip file or blob) You need the send the original zip file with ajax when uploading.

preranaB commented 6 years ago

But can I send that 256 MB file directly or should I break down the file into small pieces (creating multiple zip files each containing 30-40 files and then sending it one by one)?

jimmywarting commented 6 years ago

You can just send it as it's.