description and source-codejsftp = function (cfg) {
this.host = cfg.host || 'localhost';
this.port = cfg.port || FTP_PORT;
this.user = cfg.user || 'anonymous';
this.pass = cfg.pass || '@anonymous';
// True if the server doesn't support the `stat` command. Since listing a
// directory or retrieving file properties is quite a common operation, it is
// more efficient to avoid the round-trip to the server.
this.useList = cfg.useList || false;
this.commandQueue = [];
EventEmitter.call(this);
var self = this;
// Generate generic methods from parameter names. they can easily be
// overriden if we need special behavior. they accept any parameters given,
// it is the responsibility of the user to validate the parameters.
this.raw = function() {
return runCmd.apply(self, arguments);
};
COMMANDS.forEach(function(cmd) {
self.raw[cmd] = util.deprecate(
runCmd.bind(self, cmd),
'Ftp.raw[' + cmd + '](args): Use Ftp.raw(\'' + cmd + ' args\') instead.');
});
this.on('data', dbgResponse);
this._createSocket(this.port, this.host);
}