adm-zip

Download zip with axios and unzip with adm-zip in memory (electron app)

安稳与你 提交于 2021-02-10 23:28:00
问题 I need to download a file with axios and unzip it in memory in an electron app. I read in some SO threads (e.g.), that adm-zip supports byte buffer constructor, but I can not see this in the docs. When I extract the content, it behaves like the array is empty, but it is not. It just does create a file and does not throw any errors I do not want to use request , as the api is marked deprecated. My code is this: const axios = require("axios"); const AdmZip = require('adm-zip'); const url =

Can not open zip file after downloading through nodejs application because of Invalid CEN error

牧云@^-^@ 提交于 2019-12-08 04:34:23
问题 I need to download and unzip zip archive in my nodejs application. I have this code: utils.apiRequest(teamcityOptions) .then(function (loadedData) { var tempDir = tmp.dirSync(); var tmpZipFileName = tempDir.name + "\\" + 'bob.zip'; fs.appendFileSync(tmpZipFileName, loadedData); var zip; try { zip = new AdmZip(tmpZipFileName); } catch (e) { log('Can not create zip, bad data', e); } }); This code gives me error: Can not create zip, bad data Invalid CEN header (bad signature) I am using Windows