how compress .xlsx files to .zip using jszip??

67 views
Skip to first unread message

Somepalli

unread,
Apr 1, 2017, 6:55:31 PM4/1/17
to nodejs
Hi
 i am new to node i have a requirement where i have to compress a set of received .xlsx files into .zip. I have to again email this zip as an attachement. I could now attach a single xlsx file into the mail, but i am clueless how to compress this file into a zip.kindly help

Please look at below code snippet where .xlsx is generated.

  // XLSX file
        attachements.push(...[report.emailParts.XLSX].filter(a=>a).map((xlsx) => {
            let out_file_name = "";
          let a=[];
            try {
                 out_file_name = out_file_pattern_to_name(
                    report.parts[0].outfile_pattern || outfile_pattern,
                    {Name: report.parts[0].Name || name});
            } catch (e)  {
                console.dir(e);
                process.exit(1);
            }
      return {
             filename:out_file_name + '.xlsx' ,
              content: new Buffer(xlsx, 'base64') 
       }

        }));
Reply all
Reply to author
Forward
0 new messages