Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (typeof data.name !== 'string' || data.name.length === 0) {
this.emit('error', new ArchiverError('ENTRYNAMEREQUIRED'));
return this;
}
if (data.type === 'directory' && !this._moduleSupports('directory')) {
this.emit('error', new ArchiverError('DIRECTORYNOTSUPPORTED', { name: data.name }));
return this;
}
source = util.normalizeInputSource(source);
if (Buffer.isBuffer(source)) {
data.sourceType = 'buffer';
} else if (util.isStream(source)) {
data.sourceType = 'stream';
} else {
this.emit('error', new ArchiverError('INPUTSTEAMBUFFERREQUIRED', { name: data.name }));
return this;
}
this._entriesCount++;
this._queue.push({
data: data,
source: source
});
return this;
};
if (typeof data.name !== 'string' || data.name.length === 0) {
this.emit('error', new Error('append: entry name must be a non-empty string value'));
return this;
}
if (data.type === 'directory' && !this._moduleSupports('directory')) {
this.emit('error', new Error('append: entries of "directory" type not currently supported by this module'));
return this;
}
source = util.normalizeInputSource(source);
if (Buffer.isBuffer(source)) {
data.sourceType = 'buffer';
} else if (util.isStream(source)) {
data.sourceType = 'stream';
} else {
this.emit('error', new Error('append: input source must be valid Stream or Buffer instance'));
return this;
}
this._queue.push({
data: data,
source: source
});
return this;
};