title: ERR Error: End of data reached (data length = 0, asked index = 4). Corrupted zip?
body: <p>im making a whatsapp bot, im saving the chats in a excel file (im using exceljs) to read and handle some responses, i prefer to use promises and resolve them, i have a function to read chats:</p>
  <pre class="lang-js prettyprint-override"><code>const readChat = (number, message, step = null) =&gt;
    new Promise((resolve, reject) =&gt; {
      setTimeout(() =&gt; {
        number = number.replace(&quot;@c.us&quot;, &quot;&quot;);
        number = `${number}@c.us`;
        const pathExcel = `./chats/${number}.xlsx`;
        const workbook = new ExcelJS.Workbook();
        const today = moment().format(&quot;DD-MM-YYYY hh:mm&quot;);
  
        if (fs.existsSync(pathExcel)) {
          const workbook = new ExcelJS.Workbook();
          workbook.xlsx
            .readFile(pathExcel)
            .then(() =&gt; {
              const worksheet = workbook.getWorksheet(1);
              const lastRow = worksheet.lastRow;
              let getRowInsert = worksheet.getRow(++lastRow.number);
              getRowInsert.getCell(&quot;A&quot;).value = today;
              getRowInsert.getCell(&quot;B&quot;).value = message;
  
              if (step) {
                getRowInsert.getCell(&quot;C&quot;).value = step;
              }
  
              getRowInsert.commit();
              workbook.xlsx
                .writeFile(pathExcel)
                .then(() =&gt; {
                  const getRowPrevStep = worksheet.getRow(lastRow.number);
                  const lastStep = getRowPrevStep.getCell(&quot;C&quot;).value;
                  resolve(lastStep);
                })
                .catch((err) =&gt; {
                  console.log(&quot;ERR&quot;, err);
                  reject(&quot;error&quot;);
                });
            })
            .catch((err) =&gt; {
              console.log(&quot;ERR&quot;, err);
              reject(&quot;error&quot;);
            });
        } else {
          const worksheet = workbook.addWorksheet(&quot;Chats&quot;);
          worksheet.columns = [
            { header: &quot;Fecha&quot;, key: &quot;number_customer&quot; },
            { header: &quot;Mensajes&quot;, key: &quot;message&quot; },
            { header: &quot;Paso&quot;, key: &quot;step&quot; },
          ];
  
          step = step || &quot;&quot;;
  
          worksheet.addRow([today, message, step]);
          workbook.xlsx
            .writeFile(pathExcel)
            .then(() =&gt; {
              resolve(&quot;STEP_1&quot;);
            })
            .catch((err) =&gt; {
              console.log(&quot;Error&quot;, err);
              reject(&quot;error&quot;);
            });
        }
      }, 1000);
    });
  </code></pre>
  <p>but the code after that else, its giving me the error: ERR Error: End of data reached (data length = 0, asked index = 4). Corrupted zip ?, the else, is supposed to be executed when there is no excel saved with that chat. I searched in many questions and pages, but i have not found any solution</p>