ftpimp
ftpimp copied to clipboard
Username With \ not work
I try this username Azure format: appservice\username and return me:
handle.data.waiting: false 331 ....................
331 Password required
331
Thanks for reporting the issue, Azure has a free tier, if I have time I will try to add support. Can you try this and share your results? You'll need to update the configuration object.
/** Add your config **/
var config = {
host: 'localhost',
port: 21,
user: 'root',
pass: '',
debug: true
};
const FTP = require('ftpimp');
const ftp = FTP.create(config, false);
//add the code to handle requesting a password
ftp.cmd.codes[331] = 'sendPass';
//change login to only send user
ftp.cmd.login = ftp.user(ftp.config.user, (err, data) => {
if (err) {
return console.log(err);
}
console.log('user sent');
});
//attach sendPass so that when 331 comes in, this method is triggered
ftp.cmd.sendPass = function () {
console.log('sending pass');
ftp.pass(ftp.config.pass, function (err, data) {
if (err) {
return console.log(err);
}
console.log('password sent');
ftp.raw('CWD', function (res) {
var dir = res.indexOf('/');
dir = res.slice(dir - 1).trim();
ftp.cwd = ftp.baseDir = dir;
console.log('current dir: ' + ftp.cwd);
ftp.emit('ready');
ftp.isReady = true;
});
});
};