Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Archiver.prototype.bulk = function(mappings) {
if (this._state.finalize || this._state.aborted) {
this.emit('error', new Error('bulk: queue closed'));
return this;
}
if (!Array.isArray(mappings)) {
mappings = [mappings];
}
var self = this;
var files = util.file.normalizeFilesArray(mappings);
files.forEach(function(file){
var isExpandedPair = file.orig.expand || false;
var data = {};
var dataFunction = false;
if (typeof file.data === 'function') {
dataFunction = file.data;
} else if (typeof file.data === 'object') {
data = file.data;
}
file.src.forEach(function(filepath) {
var entryData = _.extend({}, data);
var entryName = isExpandedPair ? file.dest : (file.dest || '') + '/' + filepath;
entryData.name = util.sanitizePath(entryName);