Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jsftp

Package Overview
Dependencies
Maintainers
1
Versions
84
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsftp - npm Package Compare versions

Comparing version 1.3.8 to 1.3.9

.flowconfig

83

lib/jsftp.js

@@ -35,4 +35,7 @@ /* vim:set ts=2 sw=2 sts=2 expandtab */

// Regular Expressions
var RE_PASV = /([-\d]+,[-\d]+,[-\d]+,[-\d]+),([-\d]+),([-\d]+)/;
var FTP_NEWLINE = /\r\n|\n/;
function getPasvPort(text, cb) {
var RE_PASV = /([-\d]+,[-\d]+,[-\d]+,[-\d]+),([-\d]+),([-\d]+)/;
var match = RE_PASV.exec(text);

@@ -147,7 +150,10 @@ if (!match) {

// If we receive a Mark and it is not expected, we ignore that command
if (!next.expectsMark || next.expectsMark.marks.indexOf(data.code) === -1)
if (!next.expectsMark || next.expectsMark.marks.indexOf(data.code) === -1) {
return;
}
// We might have to ignore the command that comes after the mark.
if (next.expectsMark.ignore)
if (next.expectsMark.ignore) {
this.ignoreCmdCode = next.expectsMark.ignore;
}
}

@@ -265,6 +271,7 @@

Ftp.prototype._parseFeats = function(features) {
// Ignore header and footer
return features.split(/\r\n|\n/).slice(1, -1).map(function(feat) {
return (/^\s*(\w*)\s*/).exec(feat)[1].trim().toLowerCase();
});
// Split and ignore header and footer
var featureLines = features.split(FTP_NEWLINE).slice(1, -1);
return featureLines
.map(function(feat) { return feat.trim().toLowerCase(); })
.filter(function(feat) { return !!feat; });
};

@@ -279,4 +286,5 @@

self.raw.syst(function(err, res) {
if (!err && res.code === 215)
if (!err && res.code === 215) {
self.system = res.text.toLowerCase();
}

@@ -302,4 +310,5 @@ callback(null, self.features);

var cb;
while (cb = self.pending.shift())
while (cb = self.pending.shift()) {
cb(err, res);
}
}

@@ -413,13 +422,14 @@

* @param {String} remotePath File to be retrieved from the FTP server
* @param {String} localPath Local path where the new file will be created
* @param {Function} callback Gets called on either success or failure
* @param {Function|String} localPath Local path where we create the new file
* @param {Function} [callback] Gets called on either success or failure
*/
Ftp.prototype.get = function(remotePath, localPath, callback) {
var self = this;
if (arguments.length === 2) {
callback = once(localPath || NOOP);
this.getGetSocket(remotePath, callback);
var finalCallback;
if (typeof localPath === 'function') {
finalCallback = once(localPath || NOOP);
} else {
callback = once(callback || NOOP);
this.getGetSocket(remotePath, function(err, socket) {
finalCallback = function(err, socket) {
if (err) {

@@ -429,7 +439,2 @@ return callback(err);

if (!socket) {
return callback(new Error(
'An unknown error occurred when trying to retrieve PASV socket'));
}
var writeStream = fs.createWriteStream(localPath);

@@ -445,7 +450,16 @@ writeStream.on('error', callback);

});
// This ensures that any expected outcome is handled. There is no
// danger of the callback being executed several times, because it is
// wrapped in `once`.
socket.on('error', callback);
socket.on('end', callback);
socket.on('close', callback);
socket.pipe(writeStream);
socket.resume();
});
};
}
this.getGetSocket(remotePath, finalCallback);
};

@@ -479,8 +493,15 @@

function cmdCallback(err, res) {
if (err) return callback(err);
if (err) {
return callback(err);
}
if (res.code === 125 || res.code === 150)
callback(null, socket);
else
callback(new Error('Unexpected command ' + res.text));
if (!socket) {
return callback(new Error('Error when retrieving PASV socket'));
}
if (res.code === 125 || res.code === 150) {
return callback(null, socket);
}
return callback(new Error('Unexpected command ' + res.text));
}

@@ -554,3 +575,3 @@

}
return callback(err, _socket);
return callback(null, _socket);
});

@@ -571,7 +592,8 @@

self.pasvTimeout.call(self, socket, doneCallback);
_callback(null, socket);
} else {
return _callback(new Error('Unexpected command ' + res.text));
return _callback(null, socket);
}
return _callback(new Error('Unexpected command ' + res.text));
});
putCallback.expectsMark = {

@@ -581,2 +603,3 @@ marks: [125, 150],

};
self.execute('stor ' + path, putCallback);

@@ -583,0 +606,0 @@ });

{
"name": "jsftp",
"id": "jsftp",
"version": "1.3.8",
"version": "1.3.9",
"description": "A sane FTP client implementation for NodeJS",

@@ -6,0 +6,0 @@ "keywords": [ "ftp", "protocol", "files", "server", "client", "async" ],

@@ -231,3 +231,3 @@ jsftp <a href="http://flattr.com/thing/1452098/" target="_blank"><img src="http://api.flattr.com/button/flattr-badge-large.png" alt="Flattr this" title="Flattr this" border="0" /></a>

- `user_command` events: These are commands that the user issuendss to the
- `user_command` events: These are commands that the user issues to the
FTP server.

@@ -234,0 +234,0 @@

Sorry, the diff of this file is not supported yet

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