- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unzipping file results in *.cpgz file in place of contents #41
Comments
The resulting zip file contains your content as a base64 string.
The issue comes from |
Tried both of those options and got the same result. Each time I ran it, it still resulted in a *.cpgz file instead of the directory I was expecting. Here's what I tried:
|
It seems that nodejs method writeFileSync don't take an ArrayBuffer for Try to convert the ArrayBuffer into a Buffer :
|
Thanks. I'll give it a shot. Appreciate your time. |
@dduponchel Right on, that's really close. The zip file is extracting properly now, but the ZIP file itself is empty. The documentation itself doesn't explicitly say that it will add the contents of a directory along with the folder itself, but that's what most people would assume. I think I'm just going to go a diff route and dump all the files into one directory. Then I can loop over them and add each by itself. |
JSZip is designed to work in a browser. It works in nodejs but you will lack some things like the support of Buffer or utilities to recursively read a folder. Maybe we should add some explanations in the documentation. |
The need to convert some ArrayBuffer into a Buffer here is yet another effect of nodejs/node-v0.x-archive#4742 wontfixed. |
I had the same problem. Instead of using jszip I'm using this and is working fine. |
the problem is that jszip produces a pkzip file (4.5) and many archival programs only support 2.1 |
I'm using Node.js to zip up a directory using the node-zip wrapper for JSZip. The creation of my ZIP file works great, but when I try to unzip the file I get what appears to be another archive instead of the directory I was expecting.
You can check out my entire project here:
https://github.com/commadelimited/jsdownloader
The main work is being done in this file:
https://github.com/commadelimited/JSDownloader/blob/express-version/routes/download.js
But here's the relevant lines of code:
The values above are as follows:
Here's the resulting ZIP file:
http://andymatthews.net/uploads/jsd-papuxetada.zip
Could I get some input as to what's going wrong?
The text was updated successfully, but these errors were encountered: