New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

coinstac-client-core

Package Overview
Dependencies
Maintainers
4
Versions
116
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

coinstac-client-core - npm Package Compare versions

Comparing version 6.4.5 to 6.5.0

8

package.json
{
"name": "coinstac-client-core",
"version": "6.4.5",
"version": "6.5.0",
"description": "COINSTAC business logic for clients.",

@@ -32,7 +32,9 @@ "main": "src/index.js",

"dependencies": {
"archiver": "^5.3.1",
"axios": "^0.21.1",
"coinstac-manager": "^6.4.5",
"coinstac-pipeline": "^6.4.5",
"coinstac-manager": "^6.5.0",
"coinstac-pipeline": "^6.5.0",
"convict": "^6.2.1",
"csv-parse": "^4.4.3",
"form-data": "^4.0.0",
"lodash": "^4.17.10",

@@ -39,0 +41,0 @@ "mkdirp": "^0.5.1",

@@ -15,2 +15,5 @@ 'use strict';

const { ncp } = require('ncp');
const FormData = require('form-data');
const { createReadStream, createWriteStream } = require('fs');
const archiver = require('archiver');

@@ -22,6 +25,43 @@ // set w/ config etc post release

const Manager = require('coinstac-manager');
const PipelineManager = require('coinstac-pipeline');
async function getAllFiles(directoryName, results = []) {
const files = await fs.readdir(directoryName, { withFileTypes: true });
// eslint-disable-next-line no-restricted-syntax
for (const f of files) {
const fullPath = path.join(directoryName, f.name);
if (f.isDirectory()) {
// eslint-disable-next-line no-await-in-loop
await getAllFiles(fullPath, results);
} else {
results.push(fullPath);
}
}
return results;
}
function createTarFromDir(dir, zippedFilePath) {
return new Promise((resolve, reject) => {
const output = createWriteStream(zippedFilePath);
const archive = archiver('tar', {
gzip: true,
gzipOptions: {
level: 9,
},
});
archive.on('error', (err) => {
reject(err);
});
output.on('close', () => {
resolve('closed');
});
output.on('end', () => {
resolve('data has been drained');
});
archive.pipe(output);
archive.directory(dir, false);
archive.finalize();
});
}
/**

@@ -53,6 +93,4 @@ * Create a user client for COINSTAC

this.clientServerURL = opts.clientServerURL;
this.imageDirectory = opts.imageDirectory;
this.Manager = Manager;
this.Manager.setLogger(this.logger);
/* istanbul ignore if */

@@ -88,5 +126,7 @@ if (opts.logLevel) {

mqttSubChannel: this.options.mqttServer.subChannel,
}).then((manager) => {
this.pipelineManager = manager;
return manager;
imageDirectory: this.imageDirectory,
}).then((pipelineManager) => {
this.pipelineManager = pipelineManager;
this.Manager = pipelineManager.coinstacManager;
return pipelineManager;
});

@@ -303,3 +343,3 @@ }

|| (filePaths.directories
&& filePaths.directories.length > 0)
&& filePaths.directories.length > 0)
) {

@@ -443,4 +483,40 @@ stageFiles = fs.symlink;

}
async uploadFiles(runId) {
const runOutputDirectory = path.join(this.appDirectory, 'output', this.clientId, runId);
const formData = new FormData();
formData.append('runId', runId);
// zip the contents of the run directory
const fileName = `${runId}.tar.gz`;
const zippedFilePath = path.join(this.appDirectory, 'output', this.clientId, fileName);
await createTarFromDir(runOutputDirectory, zippedFilePath);
// append the readStream
const readStream = createReadStream(zippedFilePath);
formData.append('file', readStream, fileName);
const postConfig = {
headers: {
Authorization: `Bearer ${this.token}`,
...formData.getHeaders(),
},
maxContentLength: 100000000,
maxBodyLength: 1000000000,
};
axios.post(
`${process.env.API_URL}/uploadFiles`,
formData,
postConfig
).then((result) => {
this.logger.info(result);
}).catch((e) => {
this.logger.error(e);
});
// delete the zipped file here?
}
}
module.exports = CoinstacClient;
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