'Adding multiple files on a zip archive in javascript

I'm trying to put some files in a ZIP archive without saving it (only downloading it once)

          selectedRows.forEach(async (row: any) => {
            await axiosService.get(
             [...]
                    async (responseContent: any) => {
                      zip.file(fileName, responseContent, {binary:true});             
            )});
          });
          console.log(zip);
          zip.generateAsync({ type: 'blob' }).then(function (content) {
            FileSaver.saveAs(content, 'download.zip');
         

Although the zip file has the files, the downloaded archive is empty. Where I am wrong?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source