Open Michael-1 opened 1 year ago
Using response.arrayBuffer()
instead of response.blob()
makes it work.
I found this bug today. Here is a shorter reproducing sample:
npm i jszip
echo 'Hello World' > hello.txt && zip hello.zip hello.txt
node -e "require('jszip').loadAsync(new Blob([require('fs').readFileSync('hello.zip')]));"
/home/ulysses/temp/jszip-test/node_modules/jszip/lib/utils.js:479
new Error("Can't read the data of '" + name + "'. Is it " +
^
Error: Can't read the data of 'the loaded zip file'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?
at /home/ulysses/temp/jszip-test/node_modules/jszip/lib/utils.js:479:17
Node.js v18.16.0
Version info:
I’m executing the example code for get a file with an Ajax call on NodeJS 18:
The code fails: