Trying to handle with JSZip library.
I am having an issue to unzip a file. Here’s a plunker demo. As you can see I can successfully zip a content, but when I try to unzip a zipped content I get an error (can be seen in console):
Uncaught Error: Corrupted zip : can’t find end of central directory
Any ideas why this happens?
In any case, here’s what I am trying to achieve: I have an textarea on my page. Upon click I want to zip textarea content and send zipped data to server. Another call must be able to receive a zipped data, unzip it and replace textarea text with unzipped one. Everything works ok, except unzipping problem.
解决方案
The generateAsync() method defaults to a base64 output but the loadAsync() method only see a string.
You have two solutions :
change the generated format with `generateAsync({type:”uint8array”}) (see here)
or tell the load method that you are loading base64 content : loadAsync(data,{base64:true}) (see here)