Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
jsftp bug
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
You can’t perform that action at this time.