简体   繁体   English

Adm Zip-压缩为文件夹的文件

[英]Adm Zip - files zipped as folder

I am using adm-zip to zip the local directory and all its nested files and directories. 我正在使用adm-zip压缩local directory and all its nested files and directories.

var AdmZip = require('adm-zip');
var pathToZip = process.env.PUBLIC + '/Demo/Backup.zip';
var zip = new AdmZip();
zip.addLocalFolder("C:\\Users\\Public\\Test\\db");
zip.writeZip(pathToZip);

Problem: 问题:

All the files are getting added as folders inside the zip and the actual content is not getting zipped. 所有文件都将添加为zip文件中的文件夹,而实际内容未压缩。

Where i am wrong? 我哪里错了?

There is a bug with the addLocalFolder function in Windows, but there is an easy fix, look at this entry: https://github.com/cthackers/adm-zip/pull/132/files Windows中的addLocalFolder函数存在一个错误,但有一个简单的修复程序,请查看以下条目: https : //github.com/cthackers/adm-zip/pull/132/files

Tip: Always check the current state of the library you are working with first. 提示:请始终检查您首先使用的库的当前状态。 :) :)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM