[BUG] Corrupted Zip error during appending row
- Dominant language
- JavaScript
- Stars
- 15.5k
- Forks
- 2k
- PR merge metrics
- No merged PRs in 30d
Description
## 🐛 Bug Report
Below error happens when I am trying to append a new row into existing excel.
I run it in high volume concurrency, basically you can think my script calls web-service to get a return json object, transform json object and insert into excel.
Most time it works fine, but the error occurs after hundreds executions, not always the same time.

Lib version: 4.2.0
## Steps To Reproduce
Below code is responsible for appending jsonData into the last row of excel file.
FYI. I use async-lock package (v1.2.4) to ensure data consistency, other "threads" are unable to read excel until lock is released.
```javascript
async function addRowWithJson(filePath, jsonData) {
await lock
.acquire("excelKey", async function () {
console.log("Acquire lock to write excel");
const workbook = new ExcelJS.Workbook();
await workbook.xlsx.readFile(filePath);
let worksheet = workbook.getWorksheet(sheetName);
worksheet.columns = columnSetting;
const row = worksheet.addRow(jsonData);
row.alignment = { vertical: "bottom", horizontal: "center" };
await workbook.xlsx.writeFile(filePath);
console.log("Row added");
})
.then(function () {
console.log("Release lock");
})
.catch((error) => {
return Promise.reject(error);
});
}
```
I want to understand why it happens, then think about how to fix it. Therefore any thoughts is quite welcomed.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.