Open nitinmagdumvista opened 1 year ago
https://stackoverflow.com/questions/45661857/extract-uploaded-file-using-adm-zip
same kind of response i am getting from the API which returning zip file
i think you need to add responseType: 'arraybuffer'
, to your AxiosRequestConfig
Hi, I have the same error on a AWS lambda. It works well in local though
I am getting zip response from a external service which contains multiple files through that zip response i want to get all the files and send to another http post request but i am getting Error: Invalid CEN header (bad signature)
const authStr =
Bearer ${token}; const reqBody = logoSignature; const composerUrl = this.configService.getConfiguration('COMPOSER_URL'); const axiosPostConfig: AxiosRequestConfig = { method: 'post', url: composerUrl, headers: { Authorization: authStr, }, data: reqBody, }; let composerServiceResponse = await Utility.apiCall( axiosPostConfig, executionLog, ); console.log('composerServiceResponse', composerServiceResponse); const buffer = Buffer.from(composerServiceResponse,'binary'); const zip = new AdmZip(buffer); const entries = zip.getEntries(); for (let entry of entries) { const buffer = entry.getData(); console.log( 'File: ' + entry.entryName + ', length (bytes): ' + buffer.length + ', contents: ' + buffer.toString('utf-8'), ); }