Created
February 16, 2012 18:30
-
-
Save rickysaltzer/1846894 to your computer and use it in GitHub Desktop.
jsftp bug
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Ftp = require('jsftp'); | |
var fs = require('fs'); | |
var user = "user"; | |
var pass = "pass"; | |
var dd_ftp = function(uploader) { | |
this.uploader = uploader; | |
this.ftp = new Ftp({ | |
host: "ftp.company.com", | |
port: 21, | |
}); | |
this.ftp.auth(user, pass, function(err, res) { | |
if (err) throw err; | |
}); | |
} | |
dd_ftp.prototype = { | |
upload_file : function upload_file(f,o, res) { | |
console.log("STARTING!"); | |
var f_buff = fs.readFileSync(f); | |
this.ftp.put(o, f_buff, function(err, data) { | |
if (err) { | |
throw err; | |
} | |
else { | |
// Close FTP Connection | |
this.tmp_ftp.ftp.raw.quit(function(err, data) { | |
if (err) | |
throw err; | |
console.log("Bye!"); | |
res.send("File Uploaded!"); | |
}); | |
} | |
}); | |
}, | |
} | |
exports.dd_ftp = dd_ftp; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment