George I.
George I.

Reputation: 582

node-archiver destination folder

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?

Upvotes: 1

Views: 1845

Answers (1)

Berio
Berio

Reputation: 11

Just add expand:true, flatten:true and indicate what name you want to use for destination folder (dest: 'destinationfoldername/')

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

It workerd for me

Upvotes: 1

Related Questions