Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我一直在使用archiverjs节点模块,效果很好。我现在想使用 glob 匹配来确定要压缩哪些文件,但我也想在 zip 中设置目标路径,就像使用目录方法destPath中的选项一样。我想知道是否有一个选项或可以实现这一点的东西。
archiverjs
destPath
似乎很久没有人尝试回答这个问题了。
我在使用归档节点模块时遇到了同样的问题。我想从 glob 模式附加文件,并为它们设置目标路径而不是根目录。
然后我在存档器 github #229上发现了一个问题。令人惊讶的是,前缀选项清除了我的问题。
archive.glob('file*.txt', {cwd: source_dir}, {prefix: destination_dir});
希望它可以帮助某人。
此致,