我正在使用node-archiver压缩一些文件,在压缩文件中,我在压缩的目录下找到了归档文件。
因此,在压缩文件中,'myfile.txt‘位于这样的目录下:'home/ubuntu/some_folder/another_folder/’我希望将文件放在压缩文件的根目录下。
这就是我怀疑的代码,它负责以下内容:
archive.bulk(
{src: filePaths}
);它的文档是is here的,尽管我不知道该怎么做。
有什么想法吗?
发布于 2015-10-25 23:05:21
只需添加expand:true、flatten:true并指明要用于目标文件夹(dest: 'destinationfoldername/')的名称
archive.bulk(
{src: filePaths, dest:'destinationfoldername/', expand:true, flatten:true}
);它对我很有效
https://stackoverflow.com/questions/30966876
复制相似问题