Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

artifact-engine

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

artifact-engine - npm Package Compare versions

Comparing version 0.1.23 to 0.1.24

Engine/test.js

17

Engine/artifactEngine.js
"use strict";
const path = require('path');
var tl = require('vsts-task-lib/task');
var minimatch = require('minimatch');
const models = require('../Models');

@@ -117,4 +116,16 @@ const ci = require('./cilogger');

});
this.artifactItemStore.addItems(items);
this.artifactItemStore.updateState(item, models.TicketState.Processed);
if (items.length > 0) {
this.artifactItemStore.addItems(items);
this.artifactItemStore.updateState(item, models.TicketState.Processed);
}
else {
destProvider.putArtifactItem(item, null)
.then((item) => {
this.artifactItemStore.updateState(item, models.TicketState.Processed);
resolve();
}, (err) => {
logger_1.Logger.logInfo("Error creating folder " + item.path + ": " + err);
retryIfRequired(err);
});
}
logger_1.Logger.logInfo("Enqueued " + items.length + " for processing.");

@@ -121,0 +132,0 @@ resolve();

2

package.json
{
"name": "artifact-engine",
"version": "0.1.23",
"version": "0.1.24",
"description": "Artifact Engine to download artifacts from jenkins, teamcity, vsts",

@@ -5,0 +5,0 @@ "repository": {

@@ -44,27 +44,38 @@ "use strict";

return new Promise((resolve, reject) => {
const outputFilename = path.join(this._rootLocation, item.path);
const folder = path.dirname(outputFilename);
try {
tl.mkdirP(folder);
logger_1.Logger.logMessage(tl.loc("DownloadingTo", item.path, outputFilename));
const outputStream = fs.createWriteStream(outputFilename);
stream.pipe(outputStream);
stream.on("end", () => {
logger_1.Logger.logMessage(tl.loc("DownloadedTo", item.path, outputFilename));
if (!item.metadata) {
item.metadata = {};
}
item.metadata[models.Constants.DestinationUrlKey] = outputFilename;
});
stream.on("error", (error) => {
reject(error);
});
outputStream.on("finish", () => {
this.artifactItemStore.updateFileSize(item, outputStream.bytesWritten);
const outputItemPath = path.join(this._rootLocation, item.path);
if (item.itemType === models.ItemType.File) {
const folder = path.dirname(outputItemPath);
try {
tl.mkdirP(folder);
logger_1.Logger.logMessage(tl.loc("DownloadingTo", item.path, outputItemPath));
const outputStream = fs.createWriteStream(outputItemPath);
stream.pipe(outputStream);
stream.on("end", () => {
logger_1.Logger.logMessage(tl.loc("DownloadedTo", item.path, outputItemPath));
if (!item.metadata) {
item.metadata = {};
}
item.metadata[models.Constants.DestinationUrlKey] = outputItemPath;
});
stream.on("error", (error) => {
reject(error);
});
outputStream.on("finish", () => {
this.artifactItemStore.updateFileSize(item, outputStream.bytesWritten);
resolve(item);
});
}
catch (err) {
reject(err);
}
}
else {
try {
tl.mkdirP(outputItemPath);
resolve(item);
});
}
catch (err) {
reject(err);
}
}
catch (err) {
reject(err);
}
});

@@ -71,0 +82,0 @@ }

@@ -60,12 +60,17 @@ "use strict";

var data = '';
readStream.on('data', (chunk) => {
data += chunk;
});
readStream.on('end', () => {
this.itemsUploaded[item.path] = data;
if (item.itemType === models.ItemType.File) {
readStream.on('data', (chunk) => {
data += chunk;
});
readStream.on('end', () => {
this.itemsUploaded[item.path] = data;
resolve(item);
});
readStream.on('error', () => {
reject(item);
});
}
else {
resolve(item);
});
readStream.on('error', () => {
reject(item);
});
}
});

@@ -72,0 +77,0 @@ return promise;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc