az-iot-helper
Advanced tools
Comparing version 0.1.5 to 0.1.6
@@ -90,21 +90,25 @@ 'use strict'; | ||
function uploadFilesViaScp(config, sourceFileList, targetFileList, callback) | ||
{ | ||
var finishedFileNumber = 0; | ||
var totalFileNumber = sourceFileList.length; | ||
{ | ||
if(sourceFileList.length == 0) return; | ||
var prefix = config.device_user_name + ':' + config.device_password + '@' + config.device_host_name_or_ip_address + ':'; | ||
for(let i = 0; i < sourceFileList.length; i++) | ||
{ | ||
var onClose = function(){ | ||
console.log( "- file '" + sourceFileList[i] + "' transferred" ); | ||
if(++finishedFileNumber == totalFileNumber) | ||
{ | ||
if (callback){ | ||
callback(); | ||
} | ||
var onClose = function(){ | ||
console.log( "- file '" + sourceFileList[0] + "' transferred" ); | ||
if(sourceFileList.length == 1) | ||
{ | ||
if (callback){ | ||
callback(); | ||
} | ||
}; | ||
setTimeout(function(){scp2.scp(sourceFileList[i], prefix + targetFileList[i], onClose);}, i * 2000); | ||
} | ||
} | ||
else | ||
{ | ||
sourceFileList.splice(0, 1); | ||
targetFileList.splice(0, 1); | ||
uploadFilesViaScp(config, sourceFileList, targetFileList, callback); | ||
} | ||
}; | ||
scp2.scp(sourceFileList[0], prefix + targetFileList[0], onClose); | ||
} | ||
@@ -111,0 +115,0 @@ |
{ | ||
"name": "az-iot-helper", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"description": "helper functions used by sample applications of Azure IoT Starter Kits", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
8345
176