Socket
Socket
Sign inDemoInstall

ftp

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ftp - npm Package Compare versions

Comparing version 0.2.11 to 0.3.0

52

lib/ftp.js

@@ -16,2 +16,5 @@ var fs = require('fs'),

RE_EOL = /\r?\n/g,
RE_CWD = /"(.+)"(?: |$)/,
RE_PWD = /^"(.+)"(?: |$)/,
RE_SYST = /^([^ ]+)(?: |$)/,
RE_RES_END = /(?:^|\r?\n)(\d{3}) [^\r\n]*\r?\n/;

@@ -70,2 +73,3 @@

this._keepalive = undefined;
this._ending = false;
this.options = {

@@ -318,9 +322,10 @@ host: undefined,

FTP.prototype.end = function() {
if (this._socket && this._socket.writable)
this._socket.end();
if (this._pasvSock && this._pasvSock.writable)
this._pasvSock.end();
if (this._queue.length)
this._ending = true;
else
this._reset();
};
this._socket = undefined;
this._pasvSock = undefined;
FTP.prototype.destroy = function() {
this._reset();
};

@@ -340,9 +345,9 @@

FTP.prototype.cwd = function(path, cb) {
FTP.prototype.cwd = function(path, cb, promote) {
this._send('CWD ' + path, function(err, text, code) {
if (err)
return cb(err);
var m = /"(.+)"(?: |$)/.exec(text);
var m = RE_CWD.exec(text);
cb(undefined, m ? m[1] : undefined);
});
}, promote);
};

@@ -449,3 +454,3 @@

sendList();
});
}, true);
} else

@@ -477,3 +482,3 @@ sendList();

final();
});
}, true);
}

@@ -553,3 +558,3 @@ });

sendRetr();
});
}, true);
} else

@@ -588,3 +593,3 @@ sendRetr();

}
});
}, true);
}

@@ -616,3 +621,3 @@ });

return cb(err);
cb(undefined, /^"(.+)"(?: |$)/.exec(text)[1]);
cb(undefined, RE_PWD.exec(text)[1]);
});

@@ -706,3 +711,3 @@ };

return cb(err);
cb(undefined, /^([^ ]+)(?: |$)/.exec(text)[1]);
cb(undefined, RE_SYST.exec(text)[1]);
});

@@ -728,3 +733,3 @@ };

}
});
}, true);
} else if (err)

@@ -748,3 +753,3 @@ return cb(err);

cb(new Error('File not found'));
});
}, true);
} else if (err)

@@ -913,3 +918,3 @@ return cb(err);

sendStore();
});
}, true);
} else

@@ -954,3 +959,3 @@ sendStore();

}
});
}, true);
}

@@ -968,3 +973,4 @@ });

}
if (!this._curReq && this._queue.length) {
var queueLen = this._queue.length, self = this;
if (!this._curReq && queueLen) {
this._curReq = this._queue.shift();

@@ -976,6 +982,9 @@ if (this._curReq.cmd === 'ABOR' && this._pasvSocket)

this._socket.write(bytesCRLF);
}
} else if (!this._curReq && !queueLen && this._ending)
this._reset();
};
FTP.prototype._reset = function() {
if (this._pasvSock && this._pasvSock.writable)
this._pasvSock.end();
if (this._socket && this._socket.writable)

@@ -992,2 +1001,3 @@ this._socket.end();

this._buffer = '';
this._ending = false;
this.options.host = this.options.port = this.options.user

@@ -994,0 +1004,0 @@ = this.options.password = this.options.secure

{ "name": "ftp",
"version": "0.2.11",
"version": "0.3.0",
"author": "Brian White <mscdex@mscdex.net>",

@@ -4,0 +4,0 @@ "description": "An FTP client module for node.js",

@@ -117,4 +117,6 @@ Description

* **end**() - _(void)_ - Closes the connection to the server.
* **end**() - _(void)_ - Closes the connection to the server after any/all enqueued commands have been executed.
* **destroy**() - _(void)_ - Closes the connection to the server immediately.
### Required "standard" commands (RFC 959)

@@ -121,0 +123,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc