ftp-deploy
Advanced tools
Comparing version 0.3.1 to 0.4.0
@@ -129,6 +129,15 @@ var fs = require('fs'); | ||
function ftpPut(inFilename, cb) { | ||
thisDeployer.emit('uploading', path.join(currPath, inFilename)); | ||
var emitData = { | ||
totalFileCount: thisDeployer.total, | ||
transferredFileCount: thisDeployer.transferred, | ||
percentComplete: Math.round((thisDeployer.transferred / thisDeployer.total) * 100), | ||
filename: inFilename, | ||
relativePath: currPath | ||
}; | ||
thisDeployer.emit('uploading', emitData); | ||
var fullPathName = path.join(localRoot, currPath, inFilename); | ||
fs.readFile(fullPathName, function (err, fileData) { | ||
if (err) { | ||
if (err) { | ||
cb(err); | ||
@@ -143,3 +152,4 @@ } else { | ||
thisDeployer.transferred++; | ||
thisDeployer.emit('uploaded', path.join(currPath, inFilename)); | ||
emitData.transferredFileCount = thisDeployer.transferred; | ||
thisDeployer.emit('uploaded', emitData); | ||
cb(); | ||
@@ -146,0 +156,0 @@ } |
{ | ||
"name": "ftp-deploy", | ||
"version": "0.3.1", | ||
"version": "0.4.0", | ||
"author": "Rick Bergfalk <rick.bergfalk@gmail.com> (http://rickbergfalk.com/)", | ||
@@ -5,0 +5,0 @@ "description": "Ftp a folder from your local disk to an ftp destination. Does not delete from destination directory. Derived from grunt-ftp-deploy", |
@@ -30,11 +30,12 @@ # ftp-deploy | ||
// if you want to be notified of what ftpDeploy is doing | ||
// listen to some of the events it's emitting | ||
// Want more events? Let me know and I'll add them. | ||
ftpDeploy.on('uploading', function(relativeFilePath) { | ||
console.log('uploading ' + relativeFilePath); | ||
// to be notified of what ftpDeploy is doing | ||
ftpDeploy.on('uploading', function(data) { | ||
data.totalFileCount; // total file count being transferred | ||
data.transferredFileCount; // number of files transferred | ||
data.percentComplete; // percent as a number 1 - 100 | ||
data.filename; // filename being uploaded | ||
data.relativePath; // relative path to file being uploaded from local root location | ||
}); | ||
ftpDeploy.on('uploaded', function(relativeFilePath) { | ||
var percentTransferred = Math.round((ftpDeploy.transferred/ftpDeploy.total) * 100); | ||
console.log(percentTransferred + '% uploaded ' + relativeFilePath); | ||
ftpDeploy.on('uploaded', function(data) { | ||
console.log(data); // same data as uploading event | ||
}); | ||
@@ -46,2 +47,5 @@ ``` | ||
- 0.4.x | ||
- uploading and uploaded events emit data instead of a relative file path. | ||
- 0.3.x | ||
@@ -48,0 +52,0 @@ - New config setting **exclude** can be used to exclude folders/files from the ftp deploy process |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11213
193
68