Comparing version 0.4.7 to 0.4.8
@@ -9,3 +9,2 @@ /* | ||
var Net = require("net"); | ||
var Util = require("util"); | ||
var EventEmitter = require("events").EventEmitter; | ||
@@ -40,7 +39,4 @@ var Parser = require("./ftpParser"); | ||
var Emitter = function() { EventEmitter.call(this); }; | ||
Util.inherits(Emitter, EventEmitter); | ||
// Set up some properties used all around | ||
this.emitter = new Emitter(); | ||
this.emitter = new EventEmitter(); | ||
this.raw = {}; | ||
@@ -53,2 +49,6 @@ // This variable will be true if the server doesn't support the `stat` | ||
this.pasvCallBuffer = []; | ||
// This will contain commands sent while the socket was offline or | ||
// connecting. As soon as the socket is connected and we create streams, | ||
// they will be sent to the server. | ||
this.waitingForEnqueue = []; | ||
@@ -70,3 +70,2 @@ for (var option in cfg) | ||
this._createSocket(this.port, this.host); | ||
this._createStreams.call(this, this.socket); | ||
}; | ||
@@ -78,3 +77,2 @@ | ||
var buffer = slice.call(arguments); | ||
var stream = function stream($, stop) { | ||
@@ -95,3 +93,3 @@ next = $; | ||
return stream; | ||
} | ||
}; | ||
@@ -148,4 +146,6 @@ // Codes from 100 to 200 are FTP marks | ||
// future. | ||
S.filter(function(x) { return !Ftp.isMark(x.code); }, | ||
self.serverResponse(input)), | ||
S.filter( | ||
function(x) { return !Ftp.isMark(x.code); }, | ||
self.serverResponse(input) | ||
), | ||
// Stream of FTP commands from the client. | ||
@@ -155,2 +155,7 @@ S.append(S.list(null), function(next, stop) { cmd = next; }) | ||
(parse, function() { self.emitter.emit("disconnect", "disconnect"); }); | ||
if (this.waitingForEnqueue.length > 0) { | ||
this.cmdQueue._update.apply(null, this.waitingForEnqueue); | ||
this.waitingForEnqueue = []; | ||
} | ||
}; | ||
@@ -173,3 +178,7 @@ | ||
this.enqueue = function enqueue() { | ||
this.cmdQueue._update.apply(null, slice.call(arguments)); | ||
var args = slice.call(arguments); | ||
if (this.connecting || !this.cmdQueue) | ||
this.waitingForEnqueue = this.waitingForEnqueue.concat(args); | ||
else | ||
this.cmdQueue._update.apply(null, args); | ||
}; | ||
@@ -205,3 +214,2 @@ | ||
this._createSocket(this.port, this.host, function(_socket) { | ||
self._createStreams(_socket); | ||
self._authAndEnqueue(action, callback); | ||
@@ -254,2 +262,4 @@ }); | ||
self.emitter.emit("connect", "connect"); | ||
self._createStreams(self.socket); | ||
if (firstTask) { | ||
@@ -256,0 +266,0 @@ firstTask(self.socket); |
{ | ||
"name": "jsftp", | ||
"id": "jsftp", | ||
"version": "0.4.7", | ||
"version": "0.4.8", | ||
"description": "A sane FTP client implementation for NodeJS", | ||
@@ -6,0 +6,0 @@ "keywords": [ "ftp", "protocol", "files", "server", "client", "async" ], |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
405470
1644