DiegoZoracKy / convert-excel-to-json

Convert Excel to JSON, mapping sheet columns to object keys.
MIT License
287 stars 91 forks source link

Getting a corrupted zip error #43

Closed RichardFelix closed 4 years ago

RichardFelix commented 4 years ago

Error: Corrupted zip : can't find end of central directory

I get this error about half of the time and sometimes it works. Not sure why, the function I use is below. Thank in advance!

function convertExcelToJson(dataFile, columns){

return new Promise((resolve, reject)=>{

    let result = EXCELTOJSON({
            source: fs.readFileSync(dataFile),
            columnToKey: columns
    })

    console.log(`Coversion done ${dataFile}`);

    resolve({
        'data': result
    });
}).catch((err)=>{
    console.log(err);
    reject(err);
})    

}

RichardFelix commented 4 years ago

Disregard I figured this out, it was getting this due to a timing issue after downloading a excel file. Thank anyway!