Wednesday, 15 March 2017

how to create folder in zip file archiver - node.js

I want to create a zip file and new folder in it. I created a zip file but couldn't create folders.

Here is my node.js code;

var archiver = require('archiver');
var zip = archiver('zip');

for(var i=0; i < files.length; i++){
     zip.append(new Buffer(files[i].data.buffer), { name: files[i].name } );    
}

For example I want to create folder as /first/second and add file in it.

.zip
  first(folder)
     second(folder)
        file

How can I do it?



via mmu36478

No comments:

Post a Comment