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.glob = function(pattern, options, data) {
this._pending++;
options = util.defaults(options, {
stat: false
});
var globber = glob(pattern, options, function(err, files) {
if (err) {
this.emit('error', err);
return this;
}
files.forEach(function(file) {
entryData = _.extend({}, data);
if (options.cwd) {
entryData.name = file;
file = globber._makeAbs(file);
}
Archiver.prototype.glob = function(pattern, options, data) {
this._pending++;
options = util.defaults(options, {
stat: false
});
function onGlobEnd() {
this._pending--;
this._maybeFinalize();
}
function onGlobError(err) {
this.emit('error', err);
}
function onGlobMatch(match){
var entryData = Object.assign({}, data);
if (options.cwd) {
var Json = function(options) {
if (!(this instanceof Json)) {
return new Json(options);
}
options = this.options = util.defaults(options, {});
Transform.call(this, options);
this.supports = {
directory: true,
symlink: true
};
this.files = [];
};
ZipStream.prototype._normalizeFileData = function(data) {
data = util.defaults(data, {
type: 'file',
name: null,
linkname: null,
date: null,
mode: null,
store: this.options.store,
comment: ''
});
var isDir = data.type === 'directory';
var isSymlink = data.type === 'symlink';
if (data.name) {
data.name = util.sanitizePath(data.name);
if (!isSymlink && data.name.slice(-1) === '/') {
Archiver.prototype._normalizeEntryData = function(data, stats) {
data = util.defaults(data, {
type: 'file',
name: null,
date: null,
mode: null,
prefix: null,
sourcePath: null,
stats: false
});
if (stats && data.stats === false) {
data.stats = stats;
}
var isDir = data.type === 'directory';
if (data.name) {
var Archiver = function(format, options) {
if (!(this instanceof Archiver)) {
return new Archiver(format, options);
}
if (typeof format !== 'string') {
options = format;
format = 'zip';
}
options = this.options = util.defaults(options, {
highWaterMark: 1024 * 1024,
statConcurrency: 4
});
Transform.call(this, options);
this._format = false;
this._module = false;
this._pending = 0;
this._pointer = 0;
this._entriesCount = 0;
this._entriesProcessedCount = 0;
this._fsEntriesTotalBytes = 0;
this._fsEntriesProcessedBytes = 0;
var ZipEncryptable = function(options) {
if (!(this instanceof ZipEncryptable)) {
return new ZipEncryptable(options);
}
options = this.options = util.defaults(options, {
comment: '',
forceUTC: false,
store: false
});
this.supports = {
directory: true,
symlink: true
};
this.engine = new engine(options);
};
var Tar = function(options) {
if (!(this instanceof Tar)) {
return new Tar(options);
}
options = this.options = util.defaults(options, {
gzip: false
});
if (typeof options.gzipOptions !== 'object') {
options.gzipOptions = {};
}
this.supports = {
directory: true,
symlink: true
};
this.engine = engine.pack(options);
this.compressor = false;
if (options.gzip) {
Archiver.prototype._normalizeEntryData = function(data, stats) {
data = util.defaults(data, {
type: 'file',
name: null,
date: null,
mode: null,
prefix: null,
sourcePath: null,
stats: false
});
if (stats && data.stats === false) {
data.stats = stats;
}
var isDir = data.type === 'directory';
if (data.name) {
ZipEncryptableStream.prototype._normalizeFileData = function(data) {
data = util.defaults(data, {
type: 'file',
name: null,
linkname: null,
date: null,
mode: null,
store: this.options.store,
comment: ''
});
var isDir = data.type === 'directory';
var isSymlink = data.type === 'symlink';
if (data.name) {
data.name = util.sanitizePath(data.name);
if (!isSymlink && data.name.slice(-1) === '/') {