Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Appending file to zip in nodejs

I'm making an application in which you edit a file, and it should append the edited file to zip archive and make it downloadable. It should be cross platform (Windows and Linux).

My goal is to programmatically generate the edited file and append it to static archive (which is always the same, around 3-4MBs, but around 40-50 files).

I've looked at the following post on how to zip archives in node.js, however the answer by Eliseo Soto is OS dependent.

I've also found daraosn/node-zip, but as I understood it's not able to append a file to the archive, without remaking it.

Any suggestions on how I can complete my goal without rebuilding the whole archive from scratch for each request?

like image 582
Deepsy Avatar asked Nov 11 '22 19:11

Deepsy


1 Answers

node-zip is using JSZip. According to JSZip documentation, the archive is not recreated in yout case. (if the zip file exists, the files are added to it).

like image 118
Einav Avatar answered Nov 14 '22 22:11

Einav