You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP
Socket
Sign inDemoInstall
Socket

webpack-sftp-client

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webpack-sftp-client - npm Package Compare versions

Comparing version

to
1.2.0

73

index.js

@@ -10,4 +10,6 @@ /*!

var client = require('scp2');
var ClientLib = require('scp2');
var client = new ClientLib.Client();
function WebpackSftpClient(options) {

@@ -17,7 +19,7 @@ this.options = options;

WebpackSftpClient.prototype.apply = function(compiler) {
WebpackSftpClient.prototype.apply = function (compiler) {
var self = this;
compiler.plugin('after-emit', function(compilation) {
compiler.plugin('after-emit', function (compilation) {

@@ -30,17 +32,64 @@ var remotePath = self.options.remotePath;

var port = self.options.port || '22';
var verbose = self.options.verbose;
client.scp(self.options.path,
username + ':' + password + '@' + host + ':' + port + ':' + remotePath,
function (err) {
if (err) {
console.log(err);
}
else {
console.log('Transfer with SFTP Completd!')
}
var startTime;
var endTime;
client.on('connect', function () {
// console.log('connected');
});
client.on('ready', function () {
// console.log('ready');
startTime = new Date();
console.log('[Start Uploading] ' + startTime);
});
client.on('transfer', function (buf, up, total) {
});
client.on('write', function (p) {
if (verbose) {
console.log('Transfer ' + p.source + ' => ' + p.destination);
}
});
client.on('end', function () {
endTime = new Date();
console.log('[End Uploading] ' + new Date());
});
client.on('error', function (err) {
console.log('[Error] ' + err);
});
client.on('close', function () {
console.log('Transfer with SFTP Completed in [' + (+endTime - +startTime) / 1000 + '] seconds!');
});
var srcPath = path;
var destPath = username + ':' + password + '@' + host + ':' + port + ':' + remotePath;
uploadByDir(srcPath, destPath, client);
});
};
/**
* [uploadByDir: Upload Directory Directory & Cannot Get Detailed Uploading Info for Files]
* @param {[String]} src [description]
* @param {[String]} dest [description]
* @param {[Object]} client [description]
*/
function uploadByDir(src, dest, client) {
ClientLib.scp(src, dest, client,
function (err) {
if (err) {
console.log(err);
}
}
);
}
module.exports = WebpackSftpClient;

2

package.json
{
"name": "webpack-sftp-client",
"version": "1.1.8",
"version": "1.2.0",
"description": "a plugin for webpack as an sftp client",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -24,3 +24,5 @@ # webpack-sftp-client

path: './build/',
remotePath: '/data/website/demo/'
remotePath: '/data/website/demo/',
// Show details of files uploading
verbos: true
})

@@ -27,0 +29,0 @@ ```