使用できますbulk(mappings)
。試す:
var output = fs.createWriteStream(__dirname + '/bulk-output.zip');
var archive = archiver('zip');
output.on('close', function() {
console.log(archive.pointer() + ' total bytes');
console.log('archiver has been finalized and the output file descriptor has closed.');
});
archive.on('error', function(err) {
throw err;
});
archive.pipe(output);
archive.bulk([
{ expand: true, cwd: 'views/', src: ['*'] },
{ expand: true, cwd: 'uploads/', src: ['*'] }
]);
archive.finalize();
更新しました
または、さらに簡単に実行できます。
var output = fs.createWriteStream(__dirname + '/bulk-output.zip');
var archive = archiver('zip');
output.on('close', function() {
console.log(archive.pointer() + ' total bytes');
console.log('archiver has been finalized and the output file descriptor has closed.');
});
archive.on('error', function(err) {
throw err;
});
archive.pipe(output);
archive.directory('views', true, { date: new Date() });
archive.directory('uploads', true, { date: new Date() });
archive.finalize();