在nodejs中将文件附加到zip中将、文件、nodejs、zip

由网友(管我丑不丑又没嫁给你)分享简介:我正在制作一个应用程序,您可以在其中编辑文件,它应该将编辑后的文件附加到 zip 存档并使其可下载.它应该是跨平台的(Windows 和 Linux).I'm making an application in which you edit a file, and it should append the edited...

我正在制作一个应用程序,您可以在其中编辑文件,它应该将编辑后的文件附加到 zip 存档并使其可下载.它应该是跨平台的(Windows 和 Linux).

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

我的目标是以编程方式生成编辑后的文件并将其附加到静态存档(始终相同,大约 3-4MB,但大约 40-50 个文件).

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

我查看了以下关于如何在 node.js 中压缩档案的帖子,但是 Eliseo Soto 的回答 取决于操作系统.

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

我还找到了 daraosn/node-zip,但据我了解,它无法将文件附加到存档中,而无需重新制作.

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?

推荐答案

node-zip 正在使用 JSZip.根据 JSZip 文档,在您的情况下不会重新创建存档.(如果 zip 文件存在,则将文件添加到其中).

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

阅读全文

相关推荐

最新文章