Skip to content

Instantly share code, notes, and snippets.

@rickysaltzer
Created February 16, 2012 18:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rickysaltzer/1846894 to your computer and use it in GitHub Desktop.
Save rickysaltzer/1846894 to your computer and use it in GitHub Desktop.
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