问题标签 [archiverjs]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
297 浏览

node.js - Node.js ArchiverJS 库未写入 AWS Lambda 中的输出文件流

我正在尝试按照此处的建议使用node-archiver压缩目录的内容。该函数在 Node.js 运行时环境中的 AWS Lambda 中运行。

我的功能如下:

结果是创建了 zip,但文件大小为零:

我也无法提取存档并出现以下错误。

笔记:

  1. 源目录肯定存在,已填充,并且路径正确。
  2. 一切都被写入/tmp/AWS Lambda 允许我们读写访问的目录。
  3. 我尝试使用 Lambda 部署包上传zip二进制文件并将其作为子进程运行,但显然不支持,因为它是 32 位包。如果您有替代方案,我可以使用它来压缩节点外部的目录,这些目录可以在 Lambda 的运行时工作,请告诉我。

感谢任何帮助,谢谢!

0 投票
2 回答
285 浏览

node.js - Understanding streams in Node js

I am stuck on an issue where I need to create and download a zip of multiple files using NodeJs. Things I have tried and failed :

https://github.com/archiverjs/node-archiver/issues/364#issuecomment-573508251

https://github.com/kubernetes/kubernetes/issues/90483#issue-606722433

unexpected behavior using zip-stream NPM on Google k8s

In addition to this, now the files are encrypted as well so I have to decrypt them before adding them to zip on the fly.

Though I solved this also, my solution works perfectly while the server is running on a local machine but failed when on the Google Kubernetes Engine.

After some more research, I guess this might be because of a backpressure issue in the streams in NodeJs but as described in docs, backpressure is handled by the pipe method automatically. Is it possible that the receiving speed of the browser is not matching with the sending speed of my server/zipping if yes how to solve this problem?

All the samples related to the problem are in the links provided above.

In Addition to this readable stream is passed through decipher to decrypt it.

I tried this code with archiver, getting drain event of archiver while zipping large files, does pipe handles back pressure or not if yes why I am getting drain event from archiver.

0 投票
2 回答
683 浏览

node.js - Node.js 归档器需要通过 glob 排除文件类型的语法

使用archiver.js(对于Node.js),我需要从递归(多子目录)存档中排除图像。这是我的代码:

问题是它没有排除忽略文件。如何更正语法?

0 投票
0 回答
21 浏览

javascript - Unable to ignore archive file without ignoring all other zip files while using archiverjs glob method

I am trying to replicate the functionality of the following shell command using archiverJS, in my application.

#xA;

this is how I am doing it currently:-

#xA;

Since I am saving the zip file in the same directory that is being archived, it fails unless I ignore the archive file itself using the glob pattern '**/!(*.zip)'. However this also ignores all other zip files in the directory which I do not want. I tried to ignore the specific file like below, but it does not work.

#xA;

Is there a better way to ignore the specific zip file without ignoring all zip files all together?

0 投票
1 回答
23 浏览

javascript - node-archiver : 提取时获取重复的父 zip

我在下面写了压缩目录:

在压缩我的目录之前看起来像这样:

  • excel存档.zip
  • 测试.txt
  • 测试2.gz

当我解压缩存档(称为yayy.zip)时,其中包含以下文件:

  • excel存档.zip
  • 测试.txt
  • 测试2.gz
  • 耶耶.zip

yayy.zip里面调用了一个无效文件。我怎样才能避免这种情况?

0 投票
0 回答
26 浏览

javascript - 归档器生成的 Zip 文件在使用 fs-extra 复制后损坏

我只想将创建的 zip 复制到另一个路径。但是在我运行代码之后,我可以打开original.zip并提取它,但对于copied.zip. 由于某种原因,它已损坏。

有人知道发生了什么吗?任何帮助表示赞赏。

0 投票
0 回答
20 浏览

javascript - Archiver npm 包在根目录上创建重复的 zip 文件

}

当使用 jest 测试上面的代码时,归档器会在临时目录中创建名为“zip”的文件以及 zip 文件。有什么办法可以防止归档器创建不必要的 zip 文件?