1

I'm using node-archiver to zip some files and in the zip file I find the archived files under the directory where was zipped from.

So in the zip file, 'myfile.txt' is under this sort of directory: 'home/ubuntu/some_folder/another_folder/' I want to have the files in the root directory of the zip file.

This is the code I suspect that is in charge with this:

archive.bulk(
   {src: filePaths}
);

Its documentation is here although I don't see how to do it.

Any ideas?

4

1 回答 1

1

只需添加expand:trueflatten:true并指明您想为目标文件夹使用的名称 ( dest: 'destinationfoldername/')

archive.bulk(
   {src: filePaths, dest:'destinationfoldername/', expand:true, flatten:true}
);

它为我工作

于 2015-10-25T15:05:21.077 回答