Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
stats: false
});
if (stats && data.stats === false) {
data.stats = stats;
}
var isDir = data.type === 'directory';
if (data.name) {
if (typeof data.prefix === 'string' && '' !== data.prefix) {
data.name = data.prefix + '/' + data.name;
data.prefix = null;
}
data.name = util.sanitizePath(data.name);
if (data.type !== 'symlink' && data.name.slice(-1) === '/') {
isDir = true;
data.type = 'directory';
} else if (isDir) {
data.name += '/';
}
}
// 511 === 0777; 493 === 0755; 438 === 0666; 420 === 0644
if (typeof data.mode === 'number') {
if (win32) {
data.mode &= 511;
} else {
data.mode &= 4095
}
stats: false
});
if (stats && data.stats === false) {
data.stats = stats;
}
var isDir = data.type === 'directory';
if (data.name) {
if (typeof data.prefix === 'string' && '' !== data.prefix) {
data.name = data.prefix + '/' + data.name;
data.prefix = null;
}
data.name = util.sanitizePath(data.name);
if (data.name.slice(-1) === '/') {
isDir = true;
data.type = 'directory';
} else if (isDir) {
data.name += '/';
}
}
// 511 === 0777; 493 === 0755; 438 === 0666; 420 === 0644
if (typeof data.mode === 'number') {
data.mode &= 511;
} else if (data.stats && data.mode === null) {
data.mode = data.stats.mode & 511;
// stat isn't reliable on windows; force 0755 for dir
file.src.forEach(function(filepath) {
var entryData = _.extend({}, data);
var entryName = isExpandedPair ? file.dest : (file.dest || '') + '/' + filepath;
entryData.name = util.sanitizePath(entryName);
if (entryData.name === '.') {
return;
}
try {
if (dataFunction) {
entryData = dataFunction(entryData);
if (typeof entryData !== 'object') {
throw new Error('bulk: invalid data returned from custom function');
}
}
} catch(e) {
self.emit('error', e);
return;
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) === '/') {
isDir = true;
data.type = 'directory';
} else if (isDir) {
data.name += '/';
}
}
if (isDir || isSymlink) {
data.store = true;
}
data.date = util.dateify(data.date);
return data;
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) === '/') {
isDir = true;
data.type = 'directory';
} else if (isDir) {
data.name += '/';
}
}
if (isDir || isSymlink) {
data.store = true;
}
data.date = util.dateify(data.date);
return data;