Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (data.type !== 'file' && data.type !== 'directory' && data.type !== 'symlink') {
callback(new Error(data.type + ' entries not currently supported'));
return;
}
if (typeof data.name !== 'string' || data.name.length === 0) {
callback(new Error('entry name must be a non-empty string value'));
return;
}
if (data.type === 'symlink' && typeof data.linkname !== 'string') {
callback(new Error('entry linkname must be a non-empty string value when type equals symlink'));
return;
}
var entry = new ZipArchiveEntry(data.name);
entry.setTime(data.date, this.options.forceLocalTime);
if (data.store) {
entry.setMethod(0);
}
if (data.comment.length > 0) {
entry.setComment(data.comment);
}
if (data.type === 'symlink' && typeof data.mode !== 'number') {
data.mode = 40960; // 0120000
}
if (typeof data.mode === 'number') {
if (data.type === 'symlink') {
if (data.type !== 'file' && data.type !== 'directory' && data.type !== 'symlink') {
callback(new Error(data.type + ' entries not currently supported'));
return;
}
if (typeof data.name !== 'string' || data.name.length === 0) {
callback(new Error('entry name must be a non-empty string value'));
return;
}
if (data.type === 'symlink' && typeof data.linkname !== 'string') {
callback(new Error('entry linkname must be a non-empty string value when type equals symlink'));
return;
}
var entry = new ZipArchiveEntry(data.name);
entry.setTime(data.date, this.options.forceLocalTime);
if (data.store) {
entry.setMethod(0);
}
if (data.comment.length > 0) {
entry.setComment(data.comment);
}
if (data.type === 'symlink' && typeof data.mode !== 'number') {
data.mode = 40960; // 0120000
}
if (typeof data.mode === 'number') {
if (data.type === 'symlink') {