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._updateQueueTaskWithStats = function(task, stats) {
if (stats.isFile()) {
task.data.type = 'file';
task.data.sourceType = 'stream';
task.source = util.lazyReadStream(task.filepath);
} else if (stats.isDirectory() && this._moduleSupports('directory')) {
task.data.name = util.trailingSlashIt(task.data.name);
task.data.type = 'directory';
task.data.sourcePath = util.trailingSlashIt(task.filepath);
task.data.sourceType = 'buffer';
task.source = Buffer.concat([]);
} else if (stats.isSymbolicLink() && this._moduleSupports('symlink')) {
var linkPath = fs.readlinkSync(task.filepath);
var dirName = path.dirname(task.filepath);
task.data.type = 'symlink';
task.data.linkname = path.relative(dirName, path.resolve(dirName, linkPath));
task.data.sourceType = 'buffer';
task.source = Buffer.concat([]);
} else {
if (stats.isDirectory()) {
this.emit('warning', new ArchiverError('DIRECTORYNOTSUPPORTED', task.data));
} else if (stats.isSymbolicLink()) {
this.emit('warning', new ArchiverError('SYMLINKNOTSUPPORTED', task.data));
Archiver.prototype._updateQueueTaskWithStats = function(task, stats) {
if (stats.isFile()) {
task.data.type = 'file';
task.data.sourceType = 'stream';
task.source = util.lazyReadStream(task.filepath);
} else if (stats.isDirectory() && this._moduleSupports('directory')) {
task.data.name = util.trailingSlashIt(task.data.name);
task.data.type = 'directory';
task.data.sourcePath = util.trailingSlashIt(task.filepath);
task.data.sourceType = 'buffer';
task.source = Buffer.concat([]);
} else if (stats.isSymbolicLink() && this._moduleSupports('symlink')) {
var linkPath = fs.readlinkSync(task.filepath);
var dirName = path.dirname(task.filepath);
task.data.type = 'symlink';
task.data.linkname = path.relative(dirName, path.resolve(dirName, linkPath));
task.data.sourceType = 'buffer';
task.source = Buffer.concat([]);
} else {
if (stats.isDirectory()) {
this.emit('warning', new ArchiverError('DIRECTORYNOTSUPPORTED', task.data));
} else if (stats.isSymbolicLink()) {
this.emit('warning', new ArchiverError('SYMLINKNOTSUPPORTED', task.data));
} else {
this.emit('warning', new ArchiverError('ENTRYNOTSUPPORTED', task.data));
Archiver.prototype._updateQueueTaskWithStats = function(task, stats) {
if (stats.isFile()) {
task.data.type = 'file';
task.data.sourceType = 'stream';
task.source = util.lazyReadStream(task.filepath);
} else if (stats.isDirectory() && this._moduleSupports('directory')) {
task.data.name = util.trailingSlashIt(task.data.name);
task.data.type = 'directory';
task.data.sourcePath = util.trailingSlashIt(task.filepath);
task.data.sourceType = 'buffer';
task.source = new Buffer(0);
} else {
return task;
}
task.data = this._normalizeEntryData(task.data, stats);
return task;
};
Archiver.prototype._updateQueueTaskWithStats = function(task, stats) {
if (stats.isFile()) {
task.data.type = 'file';
task.data.sourceType = 'stream';
task.source = util.lazyReadStream(task.filepath);
} else if (stats.isDirectory() && this._moduleSupports('directory')) {
task.data.name = util.trailingSlashIt(task.data.name);
task.data.type = 'directory';
task.data.sourcePath = util.trailingSlashIt(task.filepath);
task.data.sourceType = 'buffer';
task.source = new Buffer(0);
} else {
return task;
}
task.data = this._normalizeEntryData(task.data, stats);
return task;
};