Reputation: 1306
I am building the server part of a webapp, using node.js. This involves getting data from thetvdb.com (API documentation of thetvdb). The data comes as a zip file. HTTP download is no problem, however, parsing the file is. I actually never save the file, but just keep it in memory, as suggested in How to download and unzip a zip file in memory in NodeJs?
I have a buffer with valid data (same data as when I download the file with browser/curl...). However, adm-zip (I also tired other zip libraries, some suggest invalid zip length) can't open it. It does not show an error, but the zipEntries in the end have length of 0. When I write out the buffer to the filesystem and open it with gui or cli tools it works.
I can't give a direkt link to the file, as it would involve my API key, however I re-uploaded it here.
Upvotes: 1
Views: 2999
Reputation: 9529
I think I might have an answer for you:
Don't rely on npm install
. I just ran the example that you linked to with the zip file you provided, and I get an output of "0"
.
I saw a comment on that other StackOverflow page, saying that the version of adm-zip
on npm is not up to date. I grabbed a fresh copy of adm-zip
from github, overwrote the one in my node_modules folder and reran the example code and now get the following:
...
<Actor>
<id>237811</id>
<Image>actors/237811.jpg</Image>
<Name>Peter Pratt</Name>
<Role>The Master</Role>
<SortOrder>3</SortOrder>
</Actor>
<Actor>
<id>23780s/237811.jpg</Image>
Give that a shot!
Upvotes: 1