Appending file to zip in nodejs

萝らか妹 提交于 2021-02-20 14:52:24

问题


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?


回答1:


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).



来源:https://stackoverflow.com/questions/19718504/appending-file-to-zip-in-nodejs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!