Socket
Socket
Sign inDemoInstall

sftp-to-s3

Package Overview
Dependencies
49
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.9 to 1.0.10

32

index.js
const Client = require('ssh2-sftp-client');
const streamToString = require('./lib/streamToString')
const retrieveFileStreams = require('./lib/retrieveFileStreams')
const uploadToS3 = require('./lib/uploadToS3')
const streamToString = require('./lib/streamToString');
const retrieveFileStreams = require('./lib/retrieveFileStreams');
const uploadToS3 = require('./lib/uploadToS3');
const path = require('path');

@@ -11,2 +12,27 @@ const SftpToS3 = {

return new Promise( (resolve, reject) => {
// handle path errors
if (config.aws === undefined) {
console.error("aws key is require for config");
reject("malformed config, aws key is require for config");
return;
}
if (config.aws.bucket === undefined) {
console.error("aws bucket is require in aws key");
reject("malformed config, aws bucket is require in aws key");
return;
}
if (path.isAbsolute(config.fileDownloadDir) === false) {
console.error("fileDownloadDir must be absolute");
reject("malformed config, fileDownloadDir must be absolute");
return;
}
if (path.isAbsolute(config.completedDir) === false) {
console.error("completedDir must be absolute");
reject("malformed config, completedDir must be absolute");
return;
}
return sftp.connect(config.sftp)

@@ -13,0 +39,0 @@ .then(() => {

5

package.json
{
"name": "sftp-to-s3",
"version": "1.0.9",
"version": "1.0.10",
"description": "library to upload files from sftp server to aws s3",
"main": "index.js",
"scripts": {
"test": "gulp test"
"test": "mocha test"
},

@@ -28,2 +28,3 @@ "repository": {

"chai": "^3.5.0",
"mocha": "^3.5.3",
"sinon": "^2.2.0"

@@ -30,0 +31,0 @@ },

@@ -8,3 +8,3 @@ 'use strict';

const uploadToS3 = require('../lib/uploadToS3');
const config = {test: "config", aws: {}};
const config = {test: "config", aws: {bucket: "test"}, fileDownloadDir: '/', completedDir: '/'};

@@ -50,3 +50,3 @@ describe("bypassSFTP", function() {

sinon.stub(Client.prototype, 'connect').callsFake(function() {
return Promise.reject("meowlure");
return Promise.reject("error");
});

@@ -58,3 +58,3 @@

.catch((err) => {
expect(err).to.equal("meowlure");
expect(err).to.equal("error");
done()

@@ -61,0 +61,0 @@ })

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc