+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/node_modules/jsftp/.npmignore b/node_modules/jsftp/.npmignore
new file mode 100644
index 0000000..eb33546
--- /dev/null
+++ b/node_modules/jsftp/.npmignore
@@ -0,0 +1,5 @@
+coverage.html
+*.un~
+lib-cov
+reports
+.c9revisions
diff --git a/node_modules/jsftp/.travis.yml b/node_modules/jsftp/.travis.yml
new file mode 100644
index 0000000..27aafa2
--- /dev/null
+++ b/node_modules/jsftp/.travis.yml
@@ -0,0 +1,9 @@
+language: node_js
+node_js:
+ - "0.10"
+ - "0.8"
+ - "0.6"
+
+before_script:
+ - "npm install --dev"
+
diff --git a/node_modules/jsftp/LICENSE b/node_modules/jsftp/LICENSE
new file mode 100644
index 0000000..8a34f6d
--- /dev/null
+++ b/node_modules/jsftp/LICENSE
@@ -0,0 +1,22 @@
+The MIT License
+
+Copyright(c) 2011 Ajax.org B.V.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
diff --git a/node_modules/jsftp/Makefile b/node_modules/jsftp/Makefile
new file mode 100644
index 0000000..78f4696
--- /dev/null
+++ b/node_modules/jsftp/Makefile
@@ -0,0 +1,31 @@
+# use the tools as dev dependencies rather than installing them globaly
+# it lets you handle specific versions of the tooling for each of your projects
+MOCHA=node_modules/.bin/mocha
+ISTANBUL=node_modules/.bin/istanbul
+JSHINT=node_modules/.bin/jshint
+
+# test files must end with ".test.js"
+TESTS=$(shell find test/ -name "*.test.js")
+
+clean:
+ rm -rf reports
+
+test:
+ $(MOCHA) -R spec $(TESTS)
+
+_MOCHA="node_modules/.bin/_mocha"
+coverage:
+ @# check if reports folder exists, if not create it
+ @test -d reports || mkdir reports
+ $(ISTANBUL) cover --report lcovonly --dir ./reports $(_MOCHA) -- -R spec $(TESTS)
+ genhtml reports/lcov.info --output-directory reports/
+
+jshint:
+ $(JSHINT) lib test --show-non-errors
+
+checkstyle:
+ @# check if reports folder exists, if not create it
+ @test -d reports || mkdir reports
+ $(JSHINT) lib test --reporter=checkstyle > reports/checkstyle.xml
+
+.PHONY: clean test coverage jshint checkstyle
diff --git a/node_modules/jsftp/README.md b/node_modules/jsftp/README.md
new file mode 100644
index 0000000..51d9fae
--- /dev/null
+++ b/node_modules/jsftp/README.md
@@ -0,0 +1,235 @@
+jsftp
+=====
+
+A client FTP library for NodeJS that focuses on correctness, clarity
+and conciseness. It doesn't get in the way and plays nice with streaming APIs.
+
+[![NPM](https://nodei.co/npm/jsftp.png)](https://nodei.co/npm/jsftp/)
+
+**Warning: The latest version (1.0.0) of jsftp breaks API compatibility with previous
+versions, it is NOT a drop-in replacement. Please be careful when upgrading. The
+API changes are not drastic at all and it is all documented below. If you do not
+want to upgrade yet you should stay with version 0.6.0, the last one before the
+upgrade. The API docs below are updated for 1.0.**
+
+Starting it up
+--------------
+
+```javascript
+var JSFtp = require("jsftp");
+
+var Ftp = new JSFtp({
+ host: "myserver.com",
+ port: 3331, // defaults to 21
+ user: "user", // defaults to "anonymous"
+ pass: "1234" // defaults to "@anonymous"
+};
+```
+
+jsftp gives you access to all the raw commands of the FTP protocol in form of
+methods in the `Ftp` object. It also provides several convenience methods for
+actions that require complex chains of commands (e.g. uploading and retrieving
+files, passive operations), as shown below.
+
+When raw commands succeed they always pass the response of the server to the
+callback, in the form of an object that contains two properties: `code`, which
+is the response code of the FTP operation, and `text`, which is the complete
+text of the response.
+
+Raw (or native) commands are accessible in the form `Ftp.raw["command"](params, callback)`
+
+Thus, a command like `QUIT` will be called like this:
+
+```javascript
+Ftp.raw.quit(function(err, data) {
+ if (err) return console.error(err);
+
+ console.log("Bye!");
+});
+```
+
+and a command like `MKD` (make directory), which accepts parameters, looks like this:
+
+```javascript
+Ftp.raw.mkd("/new_dir", function(err, data) {
+ if (err) return console.error(err);
+
+ console.log(data.text); // Show the FTP response text to the user
+ console.log(data.code); // Show the FTP response code to the user
+});
+```
+
+API and examples
+----------------
+
+#### new Ftp(options)
+ - `options` is an object with the following properties:
+
+ ```javascript
+ {
+ host: 'localhost', // Host name for the current FTP server.
+ port: 3333, // Port number for the current FTP server (defaults to 21).
+ user: 'user', // Username
+ pass: 'pass', // Password
+ }
+ ```
+
+Creates a new Ftp instance.
+
+
+#### Ftp.host
+
+Host name for the current FTP server.
+
+#### Ftp.port
+
+Port number for the current FTP server (defaults to 21).
+
+#### Ftp.socket
+
+NodeJS socket for the current FTP server.
+
+#### Ftp.features
+
+Array of feature names for the current FTP server. It is
+generated when the user authenticates with the `auth` method.
+
+#### Ftp.system
+
+Contains the system identification string for the remote FTP server.
+
+
+### Methods
+
+#### Ftp.raw.FTP_COMMAND([params], callback)
+All the standard FTP commands are available under the `raw` namespace. These
+commands might accept parameters or not, but they always accept a callback
+with the signature `err, data`, in which `err` is the error response coming
+from the server (usually a 4xx or 5xx error code) and the data is an object
+that contains two properties: `code` and `text`. `code` is an integer indicating
+the response code of the response and `text` is the response string itself.
+
+#### Ftp.auth(username, password, callback)
+Authenticates the user with the given username and password. If null or empty
+values are passed for those, `auth` will use anonymous credentials. `callback`
+will be called with the response text in case of successful login or with an
+error as a first parameter, in normal Node fashion.
+
+#### Ftp.ls(filePath, callback)
+Lists information about files or directories and yields an array of file objects
+with parsed file properties to the `callback`. You should use this function
+instead of `stat` or `list` in case you need to do something with the individual
+file properties.
+
+```javascript
+ftp.ls(".", function(err, res) {
+ res.forEach(function(file) {
+ console.log(file.name);
+ });
+});
+```
+
+#### Ftp.list(filePath, callback)
+Lists `filePath` contents using a passive connection. Calls callback with an
+array of strings with complete file information.
+
+```javascript
+ftp.list(remoteCWD, function(err, res) {
+ res.forEach(function(file) {
+ console.log(file.name);
+ });
+ // Prints something like
+ // -rw-r--r-- 1 sergi staff 4 Jun 03 09:32 testfile1.txt
+ // -rw-r--r-- 1 sergi staff 4 Jun 03 09:31 testfile2.txt
+ // -rw-r--r-- 1 sergi staff 0 May 29 13:05 testfile3.txt
+ // ...
+});
+```
+
+#### Ftp.get(remotePath, callback)
+Gives back a paused socket with the file contents ready to be streamed,
+or calls the callback with an error if not successful.
+
+```javascript
+ var str = ""; // Will store the contents of the file
+ ftp.get('remote/path/file.txt', function(err, socket) {
+ if (err) return;
+
+ socket.on("data", function(d) { str += d.toString(); })
+ socket.on("close", function(hadErr) {
+ if (hadErr)
+ console.error('There was an error retrieving the file.');
+ });
+ socket.resume();
+ });
+```
+
+#### Ftp.get(remotePath, localPath, callback)
+Stores the remote file directly in the given local path.
+
+```javascript
+ ftp.get('remote/file.txt, 'local/file.txt, function(hadErr) {
+ if (hadErr)
+ console.error('There was an error retrieving the file.');
+ else
+ console.log('File copied successfully!');
+ });
+```
+
+#### Ftp.put(source, remotePath, callback)
+Uploads a file to `filePath`. It accepts a string with the local path for the
+file or a `Buffer` as a `source` parameter.
+
+```javascript
+ftp.put(buffer, 'path/to/remote/file.txt', function(hadError) {
+ if (!hadError)
+ console.log("File transferred successfully!");
+});
+```
+
+#### Ftp.rename(from, to, callback)
+Renames a file in the server. `from` and `to` are both filepaths.
+
+```javascript
+ftp.rename(from, to, function(err, res) {
+ if (!err)
+ console.log("Renaming successful!");
+});
+```
+
+#### Ftp.keepAlive()
+Refreshes the interval thats keep the server connection active.
+
+You can find more usage examples in the [unit tests](https://github.com/sergi/jsftp/blob/master/test/jsftp_test.js). This documentation
+will grow as jsftp evolves.
+
+Installation
+------------
+
+ npm install jsftp
+
+Test coverage
+-------------
+
+In order to run coverage reports:
+
+ npm install --dev
+ make coverage
+
+ Current overall coverage rate:
+ lines......: 92.1% (316 of 343 lines)
+ functions..: 91.0% (71 of 78 functions)
+
+
+Tests
+-----
+
+To run tests:
+
+ npm install --dev
+ make test
+
+License
+-------
+
+See LICENSE.
diff --git a/node_modules/jsftp/index.js b/node_modules/jsftp/index.js
new file mode 100644
index 0000000..f03f905
--- /dev/null
+++ b/node_modules/jsftp/index.js
@@ -0,0 +1,2 @@
+var libpath = process.env['VFS_FTP_COV'] ? './lib-cov' : './lib';
+module.exports = require(libpath + "/jsftp");
diff --git a/node_modules/jsftp/lib/jsftp.js b/node_modules/jsftp/lib/jsftp.js
new file mode 100644
index 0000000..eee2505
--- /dev/null
+++ b/node_modules/jsftp/lib/jsftp.js
@@ -0,0 +1,650 @@
+/* vim:set ts=2 sw=2 sts=2 expandtab */
+/*global require: true module: true */
+/*
+ * @package jsftp
+ * @copyright Copyright(c) 2012 Ajax.org B.V.
+ * @author Sergi Mansilla
+ * @license https://github.com/sergi/jsFTP/blob/master/LICENSE MIT License
+ */
+
+var Net = require("net");
+var EventEmitter = require("events").EventEmitter;
+var es = require("event-stream");
+var responseHandler = require("./response");
+var Utils = require("./utils");
+var util = require("util");
+var fs = require("fs");
+
+var FTP_PORT = 21;
+var DEBUG_MODE = false;
+var TIMEOUT = 10 * 60 * 1000;
+var IDLE_TIME = 30000;
+var COMMANDS = [
+ // Commands without parameters
+ "abor", "pwd", "cdup", "feat", "noop", "quit", "pasv", "syst",
+ // Commands with one or more parameters
+ "cwd", "dele", "list", "mdtm", "mkd", "mode", "nlst", "pass", "retr", "rmd",
+ "rnfr", "rnto", "site", "stat", "stor", "type", "user", "pass", "xrmd", "opts",
+ // Extended features
+ "chmod", "size"
+];
+
+var Cmds = {};
+COMMANDS.forEach(function(cmd) {
+ cmd = cmd.toLowerCase();
+ Cmds[cmd] = function() {
+ var callback = function() {};
+ var completeCmd = cmd;
+ if (arguments.length) {
+ var args = Array.prototype.slice.call(arguments);
+ if (typeof args[args.length - 1] === "function")
+ callback = args.pop();
+
+ completeCmd += " " + args.join(" ");
+ }
+ this.execute(completeCmd.trim(), callback);
+ };
+});
+
+function once(fn) {
+ var returnValue, called = false;
+ return function() {
+ if (!called) {
+ called = true;
+ returnValue = fn.apply(this, arguments);
+ }
+ return returnValue;
+ };
+}
+
+var Ftp = module.exports = function(cfg) {
+ "use strict";
+
+ Object.keys(cfg).forEach(function(opt) {
+ if (!this[opt]) this[opt] = cfg[opt];
+ }, this);
+
+ EventEmitter.call(this);
+
+ // 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 = false;
+ this.port = this.port || FTP_PORT;
+ this.pending = []; // Pending requests
+ this.cmdBuffer_ = [];
+ this.responseHandler = responseHandler();
+
+ // Generate generic methods from parameter names. they can easily be
+ // overriden if we need special behavior. they accept any parameters given,
+ // it is the responsability of the user to validate the parameters.
+ var raw = this.raw = {};
+ COMMANDS.forEach(function(cmd) { raw[cmd] = Cmds[cmd].bind(this); }, this);
+
+ this.socket = this._createSocket(this.port, this.host);
+};
+
+util.inherits(Ftp, EventEmitter);
+
+Ftp.prototype.reemit = function(event) {
+ var self = this;
+ return function(data) { self.emit(event, data); }
+};
+
+Ftp.prototype._createSocket = function(port, host, firstAction) {
+ if (this.socket && this.socket.destroy) this.socket.destroy();
+
+ this.authenticated = false;
+ var socket = Net.createConnection(port, host);
+ socket.on("connect", this.reemit("connect"));
+ socket.on("timeout", this.reemit("timeout"));
+
+ if (firstAction)
+ socket.once("connect", firstAction);
+
+ this._createStreams(socket);
+
+ return socket;
+};
+
+Ftp.prototype._createStreams = function(socket) {
+ this.pipeline = es.pipeline(
+ socket,
+ es.split(),
+ es.mapSync(this.responseHandler));
+
+ var self = this;
+ this.pipeline.on('data', function(data) {
+ self.emit('data', data);
+ self.parseResponse.call(self, data)
+ });
+ this.pipeline.on("error", this.reemit("error"));
+};
+
+Ftp.prototype.parseResponse = function(data) {
+ if (!this.cmdBuffer_.length)
+ return;
+
+ if ([220].indexOf(data.code) > -1)
+ return;
+
+ var next = this.cmdBuffer_[0][1];
+ if (Utils.isMark(data.code)) {
+ // If we receive a Mark and it is not expected, we ignore
+ // that command
+ 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)
+ this.ignoreCmdCode = next.expectsMark.ignore;
+ }
+
+ if (this.ignoreCmdCode && this.ignoreCmdCode === data.code) {
+ this.ignoreCmdCode = null;
+ return;
+ }
+
+ this.parse(data, this.cmdBuffer_.shift());
+};
+
+/**
+ * Writes a new command to the server.
+ *
+ * @param {String} command Command to write in the FTP socket
+ * @returns void
+ */
+Ftp.prototype.send = function(command) {
+ if (!command || typeof command !== "string")
+ return;
+
+ this.emit("cmdSend", command);
+ this.pipeline.write(command + "\r\n");
+};
+
+Ftp.prototype.nextCmd = function() {
+ if (!this.inProgress && this.cmdBuffer_[0]) {
+ this.send(this.cmdBuffer_[0][0]);
+ this.inProgress = true;
+ }
+};
+
+/**
+ * Check whether the ftp user is authenticated at the moment of the
+ * enqueing. ideally this should happen in the `push` method, just
+ * before writing to the socket, but that would be complicated,
+ * since we would have to 'unshift' the auth chain into the queue
+ * or play the raw auth commands (that is, without enqueuing in
+ * order to not mess up the queue order. ideally, that would be
+ * built into the queue object. all this explanation to justify a
+ * slight slopiness in the code flow.
+ *
+ * @param {string} action
+ * @param {function} callback
+ * @return void
+ */
+Ftp.prototype.execute = function(action, callback) {
+ if (!callback) callback = function() {};
+
+ if (this.socket && this.socket.writable) {
+ this._executeCommand(action, callback);
+ } else {
+ var self = this;
+ this.authenticated = false;
+ this.socket = this._createSocket(this.port, this.host, function() {
+ self._executeCommand(action, callback);
+ });
+ }
+};
+
+Ftp.prototype._executeCommand = function(action, callback) {
+ var self = this;
+
+ function executeCmd() {
+ self.cmdBuffer_.push([action, callback]);
+ self.nextCmd();
+ }
+
+ if (self.authenticated || /feat|syst|user|pass/.test(action)) {
+ executeCmd();
+ } else {
+ this.getFeatures(function() {
+ self.auth(self.user, self.pass, executeCmd);
+ });
+ }
+};
+
+/**
+ * Parse is called each time that a comand and a request are paired
+ * together. That is, each time that there is a round trip of actions
+ * between the client and the server. The `action` param contains an array
+ * with the response from the server as a first element (text) and an array
+ * with the command executed and the callback (if any) as the second
+ * element.
+ *
+ * @param action {Array} Contains server response and client command info.
+ */
+Ftp.prototype.parse = function(response, command) {
+ // In FTP every response code above 399 means error in some way.
+ // Since the RFC is not respected by many servers, we are going to
+ // overgeneralize and consider every value above 399 as an error.
+ var err = null;
+ if (response.code > 399) {
+ err = new Error(response.text || "Unknown FTP error.");
+ err.code = response.code;
+ }
+
+ command[1](err, response);
+ this.inProgress = false;
+ this.nextCmd();
+};
+
+/**
+ * Returns true if the current server has the requested feature. False otherwise.
+ *
+ * @param {String} feature Feature to look for
+ * @returns {Boolean} Whether the current server has the feature
+ */
+Ftp.prototype.hasFeat = function(feature) {
+ if (feature)
+ return this.features.indexOf(feature.toLowerCase()) > -1;
+};
+
+/**
+ * Returns an array of features supported by the current FTP server
+ *
+ * @param {String} features Server response for the 'FEAT' command
+ * @returns {String[]} Array of feature names
+ */
+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();
+ });
+};
+
+
+// Below this point all the methods are action helpers for FTP that compose
+// several actions in one command
+
+Ftp.prototype.getFeatures = function(callback) {
+ var self = this;
+ if (!this.features)
+ this.raw.feat(function(err, response) {
+ self.features = err ? [] : self._parseFeats(response.text);
+ self.raw.syst(function(err, res) {
+ if (!err && res.code === 215)
+ self.system = res.text.toLowerCase();
+
+ callback(null, self.features);
+ });
+ });
+ else
+ callback(null, self.features);
+};
+
+/**
+ * Authenticates the user.
+ *
+ * @param user {String} Username
+ * @param pass {String} Password
+ * @param callback {Function} Follow-up function.
+ */
+Ftp.prototype.auth = function(user, pass, callback) {
+ this.pending.push(callback);
+
+ var self = this;
+
+ function notifyAll(err, res) {
+ var cb;
+ while (cb = self.pending.shift())
+ cb(err, res);
+ }
+
+ if (this.authenticating) return;
+
+ if (!user) user = "anonymous";
+ if (!pass) pass = "@anonymous";
+
+ this.authenticating = true;
+ self.raw.user(user, function(err, res) {
+ if (!err && [230, 331, 332].indexOf(res.code) > -1) {
+ self.raw.pass(pass, function(err, res) {
+ self.authenticating = false;
+
+ if (err)
+ notifyAll(new Error("Login not accepted"));
+
+ if ([230, 202].indexOf(res.code) > -1) {
+ self.authenticated = true;
+ self.user = user;
+ self.pass = pass;
+ self.raw.type("I", function() {
+ notifyAll(null, res);
+ });
+ } else if (res.code === 332) {
+ self.raw.acct(""); // ACCT not really supported
+ }
+ });
+ } else {
+ self.authenticating = false;
+ notifyAll(new Error("Login not accepted"));
+ }
+ });
+};
+
+Ftp.prototype.setType = function(type, callback) {
+ if (this.type === type)
+ callback(null);
+
+ var self = this;
+ this.raw.type(type, function(err, data) {
+ if (!err) self.type = type;
+
+ callback(err, data);
+ });
+};
+
+/**
+ * Lists a folder's contents using a passive connection.
+ *
+ * @param {String} [path] Remote path for the file/folder to retrieve
+ * @param {Function} callback Function to call with errors or results
+ */
+Ftp.prototype.list = function(path, callback) {
+ if (arguments.length === 1) {
+ callback = arguments[0];
+ path = "";
+ }
+
+ var self = this;
+ var cb = function(err, listing) {
+ self.setType("I", once(function() {
+ callback(err, listing);
+ }));
+ };
+ cb.expectsMark = {
+ marks: [125, 150],
+ ignore: 226
+ };
+
+ var listing = "";
+ this.setType("A", function() {
+ self.getPasvSocket(function(err, socket) {
+ socket.on("data", function(data) {
+ listing += data;
+ });
+ socket.on("close", function(err) {
+ cb(err || null, listing);
+ });
+ socket.on("error", cb);
+
+ self.send("list " + (path || ""));
+ });
+ });
+};
+
+Ftp.prototype.emitProgress = function(data) {
+ this.emit('progress', {
+ filename: data.filename,
+ action: data.action,
+ total: data.totalSize || 0,
+ transferred: data.socket[
+ data.action === 'get' ? 'bytesRead' : 'bytesWritten']
+ });
+};
+
+/**
+ * Depending on the number of parameters, returns the content of the specified
+ * file or directly saves a file into the specified destination. In the latter
+ * case, an optional callback can be provided, which will receive the error in
+ * case the operation was not successful.
+ *
+ * @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
+ */
+Ftp.prototype.get = function(remotePath, localPath, callback) {
+ var self = this;
+ if (arguments.length === 2) {
+ callback = once(localPath || function() {});
+ this.getGetSocket(remotePath, callback);
+ } else {
+ callback = once(callback || function() {});
+ this.getGetSocket(remotePath, function(err, socket) {
+ if (err) {
+ callback(err);
+ }
+
+ var writeStream = fs.createWriteStream(localPath);
+ writeStream.on('error', callback);
+
+ socket.on('readable', function() {
+ self.emitProgress({
+ filename: remotePath,
+ action: 'get',
+ socket: this
+ });
+ });
+ socket.on('end', callback);
+ socket.pipe(writeStream);
+ socket.resume();
+ })
+ }
+};
+
+/**
+ * Returns a socket for a get (RETR) on a path. The socket is ready to be
+ * streamed, but it is returned in a paused state. It is left to the user to
+ * resume it.
+ *
+ * @param path {String} Path to the file to be retrieved
+ * @param callback {Function} Function to call when finalized, with the socket as a parameter
+ */
+Ftp.prototype.getGetSocket = function(path, callback) {
+ var self = this;
+ callback = once(callback);
+ this.getPasvSocket(function(err, socket) {
+ if (err) return cmdCallback(err);
+
+ socket.pause();
+
+ function cmdCallback(err, res) {
+ if (err) return callback(err);
+
+ if (res.code === 150)
+ callback(null, socket);
+ else
+ callback(new Error("Unexpected command " + res.text));
+ }
+
+ cmdCallback.expectsMark = {
+ marks: [125, 150],
+ ignore: 226
+ };
+ self.execute("retr " + path, cmdCallback);
+ });
+};
+
+/**
+ * Uploads contents on a FTP server. The `from` parameter can be a Buffer or the
+ * path for a local file to be uploaded.
+ *
+ * @param {String|Buffer} from Contents to be uploaded.
+ * @param {String} to path for the remote destination.
+ * @param {Function} callback Function to execute on error or success.
+ */
+Ftp.prototype.put = function(from, to, callback) {
+ if (from instanceof Buffer) {
+ this.getPutSocket(to, function(err, socket) {
+ if (!err) socket.end(from);
+ }, callback);
+ } else {
+ var self = this;
+ fs.exists(from, function(exists) {
+ if (!exists)
+ return callback(new Error("Local file doesn't exist."));
+
+ self.getPutSocket(to, function(err, socket) {
+ if (err) return;
+
+ fs.stat(from, function(err, stats) {
+ var totalSize = err ? 0 : stats.size;
+ var read = fs.createReadStream(from, {
+ bufferSize: 4 * 1024
+ });
+ read.pipe(socket);
+ read.on('readable', function() {
+ self.emitProgress({
+ filename: to,
+ action: 'put',
+ socket: read,
+ totalSize: totalSize
+ });
+ });
+ });
+ }, callback);
+ });
+ }
+};
+
+Ftp.prototype.getPutSocket = function(path, callback, doneCallback) {
+ if (!callback) throw new Error("A callback argument is required.");
+
+ doneCallback = once(doneCallback || function() {});
+ var _callback = once(function(err, _socket) {
+ if (err) {
+ callback(err);
+ return doneCallback(err);
+ }
+ return callback(err, _socket);
+ });
+
+ var self = this;
+ this.getPasvSocket(function(err, socket) {
+ if (err) return _callback(err);
+
+ var putCallback = once(function putCallback(err, res) {
+ if (err) return _callback(err);
+
+ // Mark 150 indicates that the 'STOR' socket is ready to receive data.
+ // Anything else is not relevant.
+ if (res.code === 150) {
+ socket.on('close', doneCallback);
+ socket.on('error', doneCallback);
+ _callback(null, socket);
+ } else {
+ return _callback(new Error("Unexpected command " + res.text));
+ }
+ });
+ putCallback.expectsMark = {
+ marks: [125, 150],
+ ignore: 226
+ };
+ self.execute("stor " + path, putCallback);
+ });
+};
+
+Ftp.prototype.getPasvSocket = function(callback) {
+ var timeout = this.timeout;
+ callback = once(callback || function() {});
+ this.execute("pasv", function(err, res) {
+ if (err) return callback(err);
+
+ var pasvRes = Utils.getPasvPort(res.text);
+ if (pasvRes === false)
+ return callback(new Error("PASV: Bad host/port combination"));
+
+ var host = pasvRes[0];
+ var port = pasvRes[1];
+ var socket = Net.createConnection(port, host);
+ socket.setTimeout(timeout || TIMEOUT);
+ callback(null, socket);
+ });
+};
+
+/**
+ * Provides information about files. It lists a directory contents or
+ * a single file and yields an array of file objects. The file objects
+ * contain several properties. The main difference between this method and
+ * 'list' or 'stat' is that it returns objects with the file properties
+ * already parsed.
+ *
+ * Example of file object:
+ *
+ * {
+ * name: 'README.txt',
+ * type: 0,
+ * time: 996052680000,
+ * size: '2582',
+ * owner: 'sergi',
+ * group: 'staff',
+ * userPermissions: { read: true, write: true, exec: false },
+ * groupPermissions: { read: true, write: false, exec: false },
+ * otherPermissions: { read: true, write: false, exec: false }
+ * }
+ *
+ * The constants used in the object are defined in ftpParser.js
+ *
+ * @param filePath {String} Path to the file or directory to list
+ * @param callback {Function} Function to call with the proper data when
+ * the listing is finished.
+ */
+Ftp.prototype.ls = function(filePath, callback) {
+ function entriesToList(err, entries) {
+ if (err) {
+ return callback(err);
+ }
+ callback(null, Utils.parseEntry(entries.text || entries));
+ }
+
+ if (this.useList) {
+ this.list(filePath, entriesToList);
+ } else {
+ var self = this;
+ this.raw.stat(filePath, function(err, data) {
+ // We might be connected to a server that doesn't support the
+ // 'STAT' command, which is set as default. We use 'LIST' instead,
+ // and we set the variable `useList` to true, to avoid extra round
+ // trips to the server to check.
+ if ((err && (err.code === 502 || err.code === 500)) ||
+ (self.system && self.system.indexOf("hummingbird") > -1))
+ // Not sure if the "hummingbird" system check ^^^ is still
+ // necessary. If they support any standards, the 500 error
+ // should have us covered. Let's leave it for now.
+ {
+ self.useList = true;
+ self.list(filePath, entriesToList);
+ } else {
+ entriesToList(err, data);
+ }
+ });
+ }
+};
+
+Ftp.prototype.rename = function(from, to, callback) {
+ var self = this;
+ this.raw.rnfr(from, function(err, res) {
+ if (err) return callback(err);
+ self.raw.rnto(to, function(err, res) {
+ callback(err, res);
+ });
+ });
+};
+
+Ftp.prototype.keepAlive = function() {
+ var self = this;
+ if (this._keepAliveInterval)
+ clearInterval(this._keepAliveInterval);
+
+ this._keepAliveInterval = setInterval(self.raw.noop, IDLE_TIME);
+};
+
+Ftp.prototype.destroy = function() {
+ if (this._keepAliveInterval)
+ clearInterval(this._keepAliveInterval);
+
+ this.socket.destroy();
+ this.features = null;
+ this.authenticated = false;
+};
diff --git a/node_modules/jsftp/lib/lib/jsftp.js b/node_modules/jsftp/lib/lib/jsftp.js
new file mode 100644
index 0000000..6901348
--- /dev/null
+++ b/node_modules/jsftp/lib/lib/jsftp.js
@@ -0,0 +1,6 @@
+if (typeof __coverage__ === 'undefined') { __coverage__ = {}; }
+if (!__coverage__['/Users/sergi/programming/jsftp/lib/jsftp.js']) {
+ __coverage__['/Users/sergi/programming/jsftp/lib/jsftp.js'] = {"path":"/Users/sergi/programming/jsftp/lib/jsftp.js","s":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0,"103":0,"104":0,"105":0,"106":0,"107":0,"108":0,"109":0,"110":0,"111":0,"112":0,"113":0,"114":0,"115":0,"116":0,"117":0,"118":0,"119":0,"120":0,"121":0,"122":0,"123":0,"124":0,"125":0,"126":0,"127":0,"128":0,"129":0,"130":0,"131":0,"132":0,"133":0,"134":0,"135":0,"136":0,"137":0,"138":0,"139":0,"140":0,"141":0,"142":0,"143":0,"144":0,"145":0,"146":0,"147":0,"148":0,"149":0,"150":0,"151":0,"152":0,"153":0,"154":0,"155":0,"156":0,"157":0,"158":0,"159":0,"160":0,"161":0,"162":0,"163":0,"164":0,"165":0,"166":0,"167":0,"168":0,"169":0,"170":0,"171":0,"172":0,"173":0,"174":0,"175":0,"176":0,"177":0,"178":0,"179":0,"180":0,"181":0,"182":0,"183":0,"184":0,"185":0,"186":0,"187":0,"188":0,"189":0,"190":0,"191":0,"192":0,"193":0,"194":0,"195":0,"196":0,"197":0,"198":0,"199":0,"200":0,"201":0,"202":0,"203":0,"204":0,"205":0,"206":0,"207":0,"208":0,"209":0,"210":0,"211":0,"212":0,"213":0,"214":0,"215":0,"216":0,"217":0,"218":0,"219":0,"220":0,"221":0,"222":0,"223":0,"224":0,"225":0,"226":0,"227":0,"228":0,"229":0,"230":0,"231":0,"232":0,"233":0,"234":0,"235":0,"236":0,"237":0,"238":0,"239":0,"240":0,"241":0,"242":0,"243":0,"244":0,"245":0,"246":0,"247":0,"248":0,"249":0,"250":0,"251":0,"252":0,"253":0,"254":0,"255":0,"256":0,"257":0,"258":0,"259":0,"260":0,"261":0,"262":0,"263":0,"264":0,"265":0,"266":0,"267":0,"268":0,"269":0,"270":0,"271":0,"272":0,"273":0,"274":0,"275":0,"276":0,"277":0,"278":0,"279":0,"280":0,"281":0,"282":0,"283":0,"284":0,"285":0,"286":0,"287":0,"288":0,"289":0,"290":0,"291":0,"292":0,"293":0,"294":0,"295":0,"296":0,"297":0,"298":0,"299":0,"300":0,"301":0,"302":0,"303":0,"304":0,"305":0,"306":0,"307":0,"308":0,"309":0,"310":0,"311":0,"312":0,"313":0,"314":0,"315":0,"316":0,"317":0,"318":0,"319":0,"320":0,"321":0,"322":0},"b":{"1":[0,0],"2":[0,0],"3":[0,0],"4":[0,0],"5":[0,0],"6":[0,0],"7":[0,0],"8":[0,0],"9":[0,0],"10":[0,0],"11":[0,0],"12":[0,0],"13":[0,0],"14":[0,0],"15":[0,0],"16":[0,0],"17":[0,0],"18":[0,0],"19":[0,0],"20":[0,0],"21":[0,0],"22":[0,0],"23":[0,0],"24":[0,0],"25":[0,0],"26":[0,0],"27":[0,0],"28":[0,0],"29":[0,0],"30":[0,0],"31":[0,0],"32":[0,0],"33":[0,0],"34":[0,0],"35":[0,0],"36":[0,0],"37":[0,0],"38":[0,0],"39":[0,0],"40":[0,0],"41":[0,0],"42":[0,0],"43":[0,0],"44":[0,0],"45":[0,0],"46":[0,0],"47":[0,0],"48":[0,0],"49":[0,0],"50":[0,0],"51":[0,0],"52":[0,0],"53":[0,0],"54":[0,0],"55":[0,0],"56":[0,0],"57":[0,0],"58":[0,0],"59":[0,0],"60":[0,0],"61":[0,0],"62":[0,0],"63":[0,0],"64":[0,0],"65":[0,0],"66":[0,0],"67":[0,0],"68":[0,0],"69":[0,0],"70":[0,0],"71":[0,0],"72":[0,0],"73":[0,0],"74":[0,0],"75":[0,0,0,0,0],"76":[0,0],"77":[0,0],"78":[0,0]},"f":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0},"fnMap":{"1":{"name":"(anonymous_1)","line":34,"loc":{"start":{"line":34,"column":17},"end":{"line":34,"column":31}}},"2":{"name":"(anonymous_2)","line":36,"loc":{"start":{"line":36,"column":14},"end":{"line":36,"column":25}}},"3":{"name":"(anonymous_3)","line":37,"loc":{"start":{"line":37,"column":19},"end":{"line":37,"column":30}}},"4":{"name":"once","line":50,"loc":{"start":{"line":50,"column":0},"end":{"line":50,"column":18}}},"5":{"name":"(anonymous_5)","line":52,"loc":{"start":{"line":52,"column":9},"end":{"line":52,"column":20}}},"6":{"name":"(anonymous_6)","line":61,"loc":{"start":{"line":61,"column":27},"end":{"line":61,"column":41}}},"7":{"name":"(anonymous_7)","line":64,"loc":{"start":{"line":64,"column":27},"end":{"line":64,"column":41}}},"8":{"name":"(anonymous_8)","line":83,"loc":{"start":{"line":83,"column":19},"end":{"line":83,"column":33}}},"9":{"name":"(anonymous_9)","line":85,"loc":{"start":{"line":85,"column":19},"end":{"line":85,"column":33}}},"10":{"name":"(anonymous_10)","line":95,"loc":{"start":{"line":95,"column":33},"end":{"line":95,"column":44}}},"11":{"name":"(anonymous_11)","line":101,"loc":{"start":{"line":101,"column":31},"end":{"line":101,"column":45}}},"12":{"name":"(anonymous_12)","line":107,"loc":{"start":{"line":107,"column":33},"end":{"line":107,"column":44}}},"13":{"name":"(anonymous_13)","line":113,"loc":{"start":{"line":113,"column":30},"end":{"line":113,"column":51}}},"14":{"name":"(anonymous_14)","line":129,"loc":{"start":{"line":129,"column":31},"end":{"line":129,"column":48}}},"15":{"name":"(anonymous_15)","line":136,"loc":{"start":{"line":136,"column":27},"end":{"line":136,"column":42}}},"16":{"name":"(anonymous_16)","line":144,"loc":{"start":{"line":144,"column":30},"end":{"line":144,"column":45}}},"17":{"name":"(anonymous_17)","line":178,"loc":{"start":{"line":178,"column":21},"end":{"line":178,"column":39}}},"18":{"name":"(anonymous_18)","line":188,"loc":{"start":{"line":188,"column":24},"end":{"line":188,"column":35}}},"19":{"name":"(anonymous_19)","line":207,"loc":{"start":{"line":207,"column":25},"end":{"line":207,"column":52}}},"20":{"name":"(anonymous_20)","line":208,"loc":{"start":{"line":208,"column":28},"end":{"line":208,"column":39}}},"21":{"name":"execute","line":220,"loc":{"start":{"line":220,"column":2},"end":{"line":220,"column":21}}},"22":{"name":"executeCmd","line":221,"loc":{"start":{"line":221,"column":4},"end":{"line":221,"column":26}}},"23":{"name":"(anonymous_23)","line":230,"loc":{"start":{"line":230,"column":23},"end":{"line":230,"column":34}}},"24":{"name":"(anonymous_24)","line":247,"loc":{"start":{"line":247,"column":22},"end":{"line":247,"column":39}}},"25":{"name":"(anonymous_25)","line":273,"loc":{"start":{"line":273,"column":24},"end":{"line":273,"column":42}}},"26":{"name":"(anonymous_26)","line":286,"loc":{"start":{"line":286,"column":28},"end":{"line":286,"column":47}}},"27":{"name":"(anonymous_27)","line":288,"loc":{"start":{"line":288,"column":52},"end":{"line":288,"column":67}}},"28":{"name":"(anonymous_28)","line":297,"loc":{"start":{"line":297,"column":28},"end":{"line":297,"column":47}}},"29":{"name":"(anonymous_29)","line":300,"loc":{"start":{"line":300,"column":18},"end":{"line":300,"column":42}}},"30":{"name":"(anonymous_30)","line":302,"loc":{"start":{"line":302,"column":20},"end":{"line":302,"column":39}}},"31":{"name":"(anonymous_31)","line":320,"loc":{"start":{"line":320,"column":21},"end":{"line":320,"column":52}}},"32":{"name":"notifyAll","line":325,"loc":{"start":{"line":325,"column":2},"end":{"line":325,"column":31}}},"33":{"name":"(anonymous_33)","line":337,"loc":{"start":{"line":337,"column":22},"end":{"line":337,"column":41}}},"34":{"name":"(anonymous_34)","line":339,"loc":{"start":{"line":339,"column":26},"end":{"line":339,"column":45}}},"35":{"name":"(anonymous_35)","line":349,"loc":{"start":{"line":349,"column":29},"end":{"line":349,"column":40}}},"36":{"name":"(anonymous_36)","line":363,"loc":{"start":{"line":363,"column":24},"end":{"line":363,"column":49}}},"37":{"name":"(anonymous_37)","line":368,"loc":{"start":{"line":368,"column":22},"end":{"line":368,"column":42}}},"38":{"name":"(anonymous_38)","line":381,"loc":{"start":{"line":381,"column":21},"end":{"line":381,"column":46}}},"39":{"name":"(anonymous_39)","line":388,"loc":{"start":{"line":388,"column":11},"end":{"line":388,"column":34}}},"40":{"name":"(anonymous_40)","line":389,"loc":{"start":{"line":389,"column":27},"end":{"line":389,"column":38}}},"41":{"name":"(anonymous_41)","line":396,"loc":{"start":{"line":396,"column":20},"end":{"line":396,"column":31}}},"42":{"name":"(anonymous_42)","line":397,"loc":{"start":{"line":397,"column":23},"end":{"line":397,"column":45}}},"43":{"name":"(anonymous_43)","line":398,"loc":{"start":{"line":398,"column":24},"end":{"line":398,"column":39}}},"44":{"name":"(anonymous_44)","line":399,"loc":{"start":{"line":399,"column":25},"end":{"line":399,"column":39}}},"45":{"name":"(anonymous_45)","line":418,"loc":{"start":{"line":418,"column":20},"end":{"line":418,"column":62}}},"46":{"name":"(anonymous_46)","line":420,"loc":{"start":{"line":420,"column":33},"end":{"line":420,"column":44}}},"47":{"name":"(anonymous_47)","line":422,"loc":{"start":{"line":422,"column":34},"end":{"line":422,"column":56}}},"48":{"name":"(anonymous_48)","line":428,"loc":{"start":{"line":428,"column":32},"end":{"line":428,"column":43}}},"49":{"name":"(anonymous_49)","line":429,"loc":{"start":{"line":429,"column":34},"end":{"line":429,"column":56}}},"50":{"name":"onError","line":431,"loc":{"start":{"line":431,"column":6},"end":{"line":431,"column":28}}},"51":{"name":"(anonymous_51)","line":439,"loc":{"start":{"line":439,"column":23},"end":{"line":439,"column":34}}},"52":{"name":"(anonymous_52)","line":454,"loc":{"start":{"line":454,"column":29},"end":{"line":454,"column":54}}},"53":{"name":"(anonymous_53)","line":457,"loc":{"start":{"line":457,"column":21},"end":{"line":457,"column":43}}},"54":{"name":"cmdCallback","line":462,"loc":{"start":{"line":462,"column":4},"end":{"line":462,"column":35}}},"55":{"name":"(anonymous_55)","line":484,"loc":{"start":{"line":484,"column":20},"end":{"line":484,"column":49}}},"56":{"name":"(anonymous_56)","line":486,"loc":{"start":{"line":486,"column":26},"end":{"line":486,"column":48}}},"57":{"name":"(anonymous_57)","line":492,"loc":{"start":{"line":492,"column":20},"end":{"line":492,"column":37}}},"58":{"name":"(anonymous_58)","line":496,"loc":{"start":{"line":496,"column":28},"end":{"line":496,"column":50}}},"59":{"name":"(anonymous_59)","line":506,"loc":{"start":{"line":506,"column":29},"end":{"line":506,"column":68}}},"60":{"name":"(anonymous_60)","line":509,"loc":{"start":{"line":509,"column":38},"end":{"line":509,"column":49}}},"61":{"name":"(anonymous_61)","line":510,"loc":{"start":{"line":510,"column":23},"end":{"line":510,"column":46}}},"62":{"name":"(anonymous_62)","line":519,"loc":{"start":{"line":519,"column":21},"end":{"line":519,"column":43}}},"63":{"name":"putCallback","line":522,"loc":{"start":{"line":522,"column":27},"end":{"line":522,"column":58}}},"64":{"name":"(anonymous_64)","line":541,"loc":{"start":{"line":541,"column":30},"end":{"line":541,"column":49}}},"65":{"name":"(anonymous_65)","line":543,"loc":{"start":{"line":543,"column":30},"end":{"line":543,"column":41}}},"66":{"name":"(anonymous_66)","line":544,"loc":{"start":{"line":544,"column":24},"end":{"line":544,"column":43}}},"67":{"name":"(anonymous_67)","line":586,"loc":{"start":{"line":586,"column":19},"end":{"line":586,"column":48}}},"68":{"name":"entriesToList","line":587,"loc":{"start":{"line":587,"column":2},"end":{"line":587,"column":39}}},"69":{"name":"(anonymous_69)","line":597,"loc":{"start":{"line":597,"column":28},"end":{"line":597,"column":48}}},"70":{"name":"(anonymous_70)","line":618,"loc":{"start":{"line":618,"column":23},"end":{"line":618,"column":52}}},"71":{"name":"(anonymous_71)","line":620,"loc":{"start":{"line":620,"column":22},"end":{"line":620,"column":41}}},"72":{"name":"(anonymous_72)","line":622,"loc":{"start":{"line":622,"column":22},"end":{"line":622,"column":41}}},"73":{"name":"(anonymous_73)","line":626,"loc":{"start":{"line":626,"column":26},"end":{"line":626,"column":37}}},"74":{"name":"(anonymous_74)","line":634,"loc":{"start":{"line":634,"column":24},"end":{"line":634,"column":35}}}},"statementMap":{"1":{"start":{"line":10,"column":0},"end":{"line":10,"column":25}},"2":{"start":{"line":11,"column":0},"end":{"line":11,"column":50}},"3":{"start":{"line":12,"column":0},"end":{"line":12,"column":31}},"4":{"start":{"line":13,"column":0},"end":{"line":13,"column":33}},"5":{"start":{"line":14,"column":0},"end":{"line":14,"column":44}},"6":{"start":{"line":15,"column":0},"end":{"line":15,"column":31}},"7":{"start":{"line":16,"column":0},"end":{"line":16,"column":27}},"8":{"start":{"line":17,"column":0},"end":{"line":17,"column":23}},"9":{"start":{"line":19,"column":0},"end":{"line":19,"column":18}},"10":{"start":{"line":20,"column":0},"end":{"line":20,"column":23}},"11":{"start":{"line":21,"column":0},"end":{"line":21,"column":29}},"12":{"start":{"line":22,"column":0},"end":{"line":22,"column":22}},"13":{"start":{"line":23,"column":0},"end":{"line":31,"column":2}},"14":{"start":{"line":33,"column":0},"end":{"line":33,"column":14}},"15":{"start":{"line":34,"column":0},"end":{"line":48,"column":3}},"16":{"start":{"line":35,"column":2},"end":{"line":35,"column":26}},"17":{"start":{"line":36,"column":2},"end":{"line":47,"column":4}},"18":{"start":{"line":37,"column":4},"end":{"line":37,"column":33}},"19":{"start":{"line":38,"column":4},"end":{"line":38,"column":26}},"20":{"start":{"line":39,"column":4},"end":{"line":45,"column":5}},"21":{"start":{"line":40,"column":6},"end":{"line":40,"column":55}},"22":{"start":{"line":41,"column":6},"end":{"line":42,"column":30}},"23":{"start":{"line":42,"column":8},"end":{"line":42,"column":30}},"24":{"start":{"line":44,"column":6},"end":{"line":44,"column":42}},"25":{"start":{"line":46,"column":4},"end":{"line":46,"column":48}},"26":{"start":{"line":50,"column":0},"end":{"line":59,"column":1}},"27":{"start":{"line":51,"column":2},"end":{"line":51,"column":34}},"28":{"start":{"line":52,"column":2},"end":{"line":58,"column":4}},"29":{"start":{"line":53,"column":4},"end":{"line":56,"column":5}},"30":{"start":{"line":54,"column":6},"end":{"line":54,"column":20}},"31":{"start":{"line":55,"column":6},"end":{"line":55,"column":46}},"32":{"start":{"line":57,"column":4},"end":{"line":57,"column":23}},"33":{"start":{"line":61,"column":0},"end":{"line":91,"column":2}},"34":{"start":{"line":64,"column":2},"end":{"line":66,"column":11}},"35":{"start":{"line":65,"column":4},"end":{"line":65,"column":41}},"36":{"start":{"line":65,"column":20},"end":{"line":65,"column":41}},"37":{"start":{"line":68,"column":2},"end":{"line":68,"column":26}},"38":{"start":{"line":73,"column":2},"end":{"line":73,"column":23}},"39":{"start":{"line":74,"column":2},"end":{"line":74,"column":36}},"40":{"start":{"line":75,"column":2},"end":{"line":75,"column":20}},"41":{"start":{"line":76,"column":2},"end":{"line":76,"column":23}},"42":{"start":{"line":77,"column":2},"end":{"line":77,"column":43}},"43":{"start":{"line":82,"column":2},"end":{"line":82,"column":26}},"44":{"start":{"line":83,"column":2},"end":{"line":83,"column":77}},"45":{"start":{"line":83,"column":35},"end":{"line":83,"column":67}},"46":{"start":{"line":85,"column":2},"end":{"line":88,"column":5}},"47":{"start":{"line":86,"column":4},"end":{"line":87,"column":23}},"48":{"start":{"line":87,"column":6},"end":{"line":87,"column":23}},"49":{"start":{"line":90,"column":2},"end":{"line":90,"column":43}},"50":{"start":{"line":93,"column":0},"end":{"line":93,"column":33}},"51":{"start":{"line":95,"column":0},"end":{"line":99,"column":2}},"52":{"start":{"line":96,"column":2},"end":{"line":96,"column":34}},"53":{"start":{"line":97,"column":2},"end":{"line":97,"column":24}},"54":{"start":{"line":98,"column":2},"end":{"line":98,"column":17}},"55":{"start":{"line":101,"column":0},"end":{"line":105,"column":2}},"56":{"start":{"line":102,"column":2},"end":{"line":102,"column":48}},"57":{"start":{"line":103,"column":2},"end":{"line":103,"column":32}},"58":{"start":{"line":104,"column":2},"end":{"line":104,"column":24}},"59":{"start":{"line":107,"column":0},"end":{"line":111,"column":2}},"60":{"start":{"line":108,"column":2},"end":{"line":108,"column":36}},"61":{"start":{"line":109,"column":2},"end":{"line":109,"column":26}},"62":{"start":{"line":110,"column":2},"end":{"line":110,"column":25}},"63":{"start":{"line":113,"column":0},"end":{"line":127,"column":2}},"64":{"start":{"line":114,"column":2},"end":{"line":114,"column":41}},"65":{"start":{"line":114,"column":19},"end":{"line":114,"column":41}},"66":{"start":{"line":116,"column":2},"end":{"line":116,"column":25}},"67":{"start":{"line":117,"column":2},"end":{"line":117,"column":29}},"68":{"start":{"line":119,"column":2},"end":{"line":119,"column":62}},"69":{"start":{"line":120,"column":2},"end":{"line":121,"column":38}},"70":{"start":{"line":122,"column":2},"end":{"line":122,"column":53}},"71":{"start":{"line":123,"column":2},"end":{"line":123,"column":57}},"72":{"start":{"line":125,"column":2},"end":{"line":125,"column":35}},"73":{"start":{"line":126,"column":2},"end":{"line":126,"column":24}},"74":{"start":{"line":129,"column":0},"end":{"line":142,"column":2}},"75":{"start":{"line":130,"column":2},"end":{"line":133,"column":38}},"76":{"start":{"line":135,"column":2},"end":{"line":135,"column":18}},"77":{"start":{"line":136,"column":2},"end":{"line":141,"column":5}},"78":{"start":{"line":137,"column":4},"end":{"line":138,"column":46}},"79":{"start":{"line":138,"column":6},"end":{"line":138,"column":46}},"80":{"start":{"line":140,"column":4},"end":{"line":141,"column":2}},"81":{"start":{"line":144,"column":0},"end":{"line":170,"column":2}},"82":{"start":{"line":145,"column":2},"end":{"line":146,"column":11}},"83":{"start":{"line":146,"column":4},"end":{"line":146,"column":11}},"84":{"start":{"line":148,"column":2},"end":{"line":149,"column":11}},"85":{"start":{"line":149,"column":4},"end":{"line":149,"column":11}},"86":{"start":{"line":151,"column":2},"end":{"line":151,"column":38}},"87":{"start":{"line":152,"column":2},"end":{"line":162,"column":3}},"88":{"start":{"line":155,"column":4},"end":{"line":156,"column":13}},"89":{"start":{"line":156,"column":6},"end":{"line":156,"column":13}},"90":{"start":{"line":160,"column":4},"end":{"line":161,"column":54}},"91":{"start":{"line":161,"column":6},"end":{"line":161,"column":54}},"92":{"start":{"line":164,"column":2},"end":{"line":167,"column":3}},"93":{"start":{"line":165,"column":4},"end":{"line":165,"column":30}},"94":{"start":{"line":166,"column":4},"end":{"line":166,"column":11}},"95":{"start":{"line":169,"column":2},"end":{"line":169,"column":46}},"96":{"start":{"line":178,"column":0},"end":{"line":186,"column":2}},"97":{"start":{"line":179,"column":2},"end":{"line":180,"column":11}},"98":{"start":{"line":180,"column":4},"end":{"line":180,"column":11}},"99":{"start":{"line":182,"column":2},"end":{"line":183,"column":58}},"100":{"start":{"line":183,"column":4},"end":{"line":183,"column":58}},"101":{"start":{"line":185,"column":2},"end":{"line":185,"column":40}},"102":{"start":{"line":188,"column":0},"end":{"line":191,"column":2}},"103":{"start":{"line":189,"column":2},"end":{"line":190,"column":37}},"104":{"start":{"line":190,"column":4},"end":{"line":190,"column":37}},"105":{"start":{"line":207,"column":0},"end":{"line":235,"column":2}},"106":{"start":{"line":208,"column":2},"end":{"line":208,"column":42}},"107":{"start":{"line":208,"column":17},"end":{"line":208,"column":42}},"108":{"start":{"line":210,"column":2},"end":{"line":210,"column":18}},"109":{"start":{"line":211,"column":2},"end":{"line":218,"column":3}},"110":{"start":{"line":212,"column":4},"end":{"line":212,"column":14}},"111":{"start":{"line":214,"column":7},"end":{"line":218,"column":3}},"112":{"start":{"line":215,"column":4},"end":{"line":215,"column":31}},"113":{"start":{"line":216,"column":4},"end":{"line":216,"column":34}},"114":{"start":{"line":217,"column":4},"end":{"line":217,"column":45}},"115":{"start":{"line":220,"column":2},"end":{"line":234,"column":3}},"116":{"start":{"line":221,"column":4},"end":{"line":224,"column":5}},"117":{"start":{"line":222,"column":6},"end":{"line":222,"column":47}},"118":{"start":{"line":223,"column":6},"end":{"line":223,"column":21}},"119":{"start":{"line":226,"column":4},"end":{"line":233,"column":5}},"120":{"start":{"line":227,"column":6},"end":{"line":227,"column":19}},"121":{"start":{"line":230,"column":6},"end":{"line":232,"column":9}},"122":{"start":{"line":231,"column":8},"end":{"line":231,"column":52}},"123":{"start":{"line":247,"column":0},"end":{"line":265,"column":2}},"124":{"start":{"line":248,"column":2},"end":{"line":248,"column":27}},"125":{"start":{"line":249,"column":2},"end":{"line":249,"column":26}},"126":{"start":{"line":250,"column":2},"end":{"line":250,"column":22}},"127":{"start":{"line":252,"column":2},"end":{"line":253,"column":46}},"128":{"start":{"line":253,"column":4},"end":{"line":253,"column":46}},"129":{"start":{"line":258,"column":2},"end":{"line":258,"column":17}},"130":{"start":{"line":259,"column":2},"end":{"line":262,"column":3}},"131":{"start":{"line":260,"column":4},"end":{"line":260,"column":59}},"132":{"start":{"line":261,"column":4},"end":{"line":261,"column":29}},"133":{"start":{"line":264,"column":2},"end":{"line":264,"column":20}},"134":{"start":{"line":273,"column":0},"end":{"line":278,"column":2}},"135":{"start":{"line":274,"column":2},"end":{"line":275,"column":61}},"136":{"start":{"line":275,"column":4},"end":{"line":275,"column":61}},"137":{"start":{"line":277,"column":2},"end":{"line":278,"column":0}},"138":{"start":{"line":286,"column":0},"end":{"line":291,"column":2}},"139":{"start":{"line":288,"column":2},"end":{"line":290,"column":5}},"140":{"start":{"line":289,"column":4},"end":{"line":289,"column":63}},"141":{"start":{"line":297,"column":0},"end":{"line":311,"column":2}},"142":{"start":{"line":298,"column":2},"end":{"line":298,"column":18}},"143":{"start":{"line":299,"column":2},"end":{"line":310,"column":34}},"144":{"start":{"line":300,"column":4},"end":{"line":308,"column":7}},"145":{"start":{"line":301,"column":6},"end":{"line":301,"column":65}},"146":{"start":{"line":302,"column":6},"end":{"line":307,"column":9}},"147":{"start":{"line":303,"column":8},"end":{"line":304,"column":47}},"148":{"start":{"line":304,"column":10},"end":{"line":304,"column":47}},"149":{"start":{"line":306,"column":8},"end":{"line":306,"column":38}},"150":{"start":{"line":310,"column":4},"end":{"line":310,"column":34}},"151":{"start":{"line":320,"column":0},"end":{"line":361,"column":2}},"152":{"start":{"line":321,"column":2},"end":{"line":321,"column":30}},"153":{"start":{"line":323,"column":2},"end":{"line":323,"column":18}},"154":{"start":{"line":325,"column":2},"end":{"line":329,"column":3}},"155":{"start":{"line":326,"column":4},"end":{"line":326,"column":11}},"156":{"start":{"line":327,"column":4},"end":{"line":328,"column":19}},"157":{"start":{"line":328,"column":6},"end":{"line":328,"column":19}},"158":{"start":{"line":331,"column":2},"end":{"line":331,"column":34}},"159":{"start":{"line":331,"column":27},"end":{"line":331,"column":34}},"160":{"start":{"line":333,"column":2},"end":{"line":333,"column":32}},"161":{"start":{"line":333,"column":13},"end":{"line":333,"column":32}},"162":{"start":{"line":334,"column":2},"end":{"line":334,"column":33}},"163":{"start":{"line":334,"column":13},"end":{"line":334,"column":33}},"164":{"start":{"line":336,"column":2},"end":{"line":336,"column":29}},"165":{"start":{"line":337,"column":2},"end":{"line":360,"column":5}},"166":{"start":{"line":338,"column":4},"end":{"line":359,"column":5}},"167":{"start":{"line":339,"column":6},"end":{"line":354,"column":9}},"168":{"start":{"line":340,"column":8},"end":{"line":340,"column":36}},"169":{"start":{"line":342,"column":8},"end":{"line":343,"column":53}},"170":{"start":{"line":343,"column":10},"end":{"line":343,"column":53}},"171":{"start":{"line":345,"column":8},"end":{"line":353,"column":9}},"172":{"start":{"line":346,"column":10},"end":{"line":346,"column":36}},"173":{"start":{"line":347,"column":10},"end":{"line":347,"column":27}},"174":{"start":{"line":348,"column":10},"end":{"line":348,"column":27}},"175":{"start":{"line":349,"column":10},"end":{"line":349,"column":67}},"176":{"start":{"line":349,"column":42},"end":{"line":349,"column":63}},"177":{"start":{"line":351,"column":13},"end":{"line":353,"column":9}},"178":{"start":{"line":352,"column":10},"end":{"line":352,"column":28}},"179":{"start":{"line":357,"column":6},"end":{"line":357,"column":34}},"180":{"start":{"line":358,"column":6},"end":{"line":358,"column":49}},"181":{"start":{"line":363,"column":0},"end":{"line":373,"column":2}},"182":{"start":{"line":364,"column":2},"end":{"line":365,"column":19}},"183":{"start":{"line":365,"column":4},"end":{"line":365,"column":19}},"184":{"start":{"line":367,"column":2},"end":{"line":367,"column":18}},"185":{"start":{"line":368,"column":2},"end":{"line":372,"column":5}},"186":{"start":{"line":369,"column":4},"end":{"line":369,"column":31}},"187":{"start":{"line":369,"column":14},"end":{"line":369,"column":31}},"188":{"start":{"line":371,"column":4},"end":{"line":371,"column":24}},"189":{"start":{"line":381,"column":0},"end":{"line":405,"column":2}},"190":{"start":{"line":382,"column":2},"end":{"line":385,"column":3}},"191":{"start":{"line":383,"column":4},"end":{"line":383,"column":28}},"192":{"start":{"line":384,"column":4},"end":{"line":384,"column":14}},"193":{"start":{"line":387,"column":2},"end":{"line":387,"column":18}},"194":{"start":{"line":388,"column":2},"end":{"line":392,"column":4}},"195":{"start":{"line":389,"column":4},"end":{"line":391,"column":8}},"196":{"start":{"line":390,"column":6},"end":{"line":390,"column":29}},"197":{"start":{"line":393,"column":2},"end":{"line":393,"column":54}},"198":{"start":{"line":395,"column":2},"end":{"line":395,"column":19}},"199":{"start":{"line":396,"column":2},"end":{"line":404,"column":5}},"200":{"start":{"line":397,"column":4},"end":{"line":403,"column":7}},"201":{"start":{"line":398,"column":6},"end":{"line":398,"column":61}},"202":{"start":{"line":398,"column":41},"end":{"line":398,"column":57}},"203":{"start":{"line":399,"column":6},"end":{"line":399,"column":70}},"204":{"start":{"line":399,"column":41},"end":{"line":399,"column":66}},"205":{"start":{"line":400,"column":6},"end":{"line":400,"column":29}},"206":{"start":{"line":402,"column":6},"end":{"line":402,"column":40}},"207":{"start":{"line":418,"column":0},"end":{"line":444,"column":2}},"208":{"start":{"line":419,"column":2},"end":{"line":443,"column":3}},"209":{"start":{"line":420,"column":4},"end":{"line":420,"column":48}},"210":{"start":{"line":422,"column":4},"end":{"line":425,"column":7}},"211":{"start":{"line":423,"column":6},"end":{"line":423,"column":36}},"212":{"start":{"line":423,"column":15},"end":{"line":423,"column":36}},"213":{"start":{"line":424,"column":6},"end":{"line":424,"column":28}},"214":{"start":{"line":428,"column":4},"end":{"line":428,"column":47}},"215":{"start":{"line":429,"column":4},"end":{"line":443,"column":2}},"216":{"start":{"line":430,"column":6},"end":{"line":430,"column":32}},"217":{"start":{"line":430,"column":17},"end":{"line":430,"column":30}},"218":{"start":{"line":431,"column":6},"end":{"line":434,"column":7}},"219":{"start":{"line":432,"column":8},"end":{"line":432,"column":67}},"220":{"start":{"line":433,"column":8},"end":{"line":433,"column":22}},"221":{"start":{"line":436,"column":6},"end":{"line":436,"column":56}},"222":{"start":{"line":437,"column":6},"end":{"line":437,"column":39}},"223":{"start":{"line":439,"column":6},"end":{"line":439,"column":55}},"224":{"start":{"line":439,"column":36},"end":{"line":439,"column":51}},"225":{"start":{"line":440,"column":6},"end":{"line":440,"column":31}},"226":{"start":{"line":441,"column":6},"end":{"line":441,"column":22}},"227":{"start":{"line":454,"column":0},"end":{"line":474,"column":2}},"228":{"start":{"line":455,"column":2},"end":{"line":455,"column":18}},"229":{"start":{"line":456,"column":2},"end":{"line":456,"column":28}},"230":{"start":{"line":457,"column":2},"end":{"line":473,"column":5}},"231":{"start":{"line":458,"column":4},"end":{"line":458,"column":37}},"232":{"start":{"line":458,"column":13},"end":{"line":458,"column":37}},"233":{"start":{"line":460,"column":4},"end":{"line":460,"column":19}},"234":{"start":{"line":462,"column":4},"end":{"line":469,"column":5}},"235":{"start":{"line":463,"column":6},"end":{"line":463,"column":36}},"236":{"start":{"line":463,"column":15},"end":{"line":463,"column":36}},"237":{"start":{"line":465,"column":6},"end":{"line":468,"column":62}},"238":{"start":{"line":466,"column":8},"end":{"line":466,"column":31}},"239":{"start":{"line":468,"column":8},"end":{"line":468,"column":62}},"240":{"start":{"line":471,"column":4},"end":{"line":471,"column":65}},"241":{"start":{"line":472,"column":4},"end":{"line":472,"column":47}},"242":{"start":{"line":484,"column":0},"end":{"line":504,"column":2}},"243":{"start":{"line":485,"column":2},"end":{"line":503,"column":3}},"244":{"start":{"line":486,"column":4},"end":{"line":488,"column":17}},"245":{"start":{"line":487,"column":6},"end":{"line":487,"column":33}},"246":{"start":{"line":487,"column":16},"end":{"line":487,"column":33}},"247":{"start":{"line":491,"column":4},"end":{"line":491,"column":20}},"248":{"start":{"line":492,"column":4},"end":{"line":502,"column":7}},"249":{"start":{"line":493,"column":6},"end":{"line":494,"column":64}},"250":{"start":{"line":494,"column":8},"end":{"line":494,"column":64}},"251":{"start":{"line":496,"column":6},"end":{"line":501,"column":19}},"252":{"start":{"line":497,"column":8},"end":{"line":500,"column":9}},"253":{"start":{"line":498,"column":10},"end":{"line":498,"column":74}},"254":{"start":{"line":499,"column":10},"end":{"line":499,"column":30}},"255":{"start":{"line":506,"column":0},"end":{"line":539,"column":2}},"256":{"start":{"line":507,"column":2},"end":{"line":507,"column":69}},"257":{"start":{"line":507,"column":17},"end":{"line":507,"column":69}},"258":{"start":{"line":509,"column":2},"end":{"line":509,"column":53}},"259":{"start":{"line":510,"column":2},"end":{"line":516,"column":5}},"260":{"start":{"line":511,"column":4},"end":{"line":514,"column":5}},"261":{"start":{"line":512,"column":6},"end":{"line":512,"column":20}},"262":{"start":{"line":513,"column":6},"end":{"line":513,"column":31}},"263":{"start":{"line":515,"column":4},"end":{"line":515,"column":34}},"264":{"start":{"line":518,"column":2},"end":{"line":518,"column":18}},"265":{"start":{"line":519,"column":2},"end":{"line":538,"column":5}},"266":{"start":{"line":520,"column":4},"end":{"line":520,"column":35}},"267":{"start":{"line":520,"column":13},"end":{"line":520,"column":35}},"268":{"start":{"line":522,"column":4},"end":{"line":535,"column":7}},"269":{"start":{"line":523,"column":6},"end":{"line":523,"column":37}},"270":{"start":{"line":523,"column":15},"end":{"line":523,"column":37}},"271":{"start":{"line":527,"column":6},"end":{"line":534,"column":7}},"272":{"start":{"line":528,"column":8},"end":{"line":528,"column":41}},"273":{"start":{"line":529,"column":8},"end":{"line":529,"column":41}},"274":{"start":{"line":530,"column":8},"end":{"line":530,"column":32}},"275":{"start":{"line":533,"column":8},"end":{"line":533,"column":70}},"276":{"start":{"line":536,"column":4},"end":{"line":536,"column":65}},"277":{"start":{"line":537,"column":4},"end":{"line":537,"column":47}},"278":{"start":{"line":541,"column":0},"end":{"line":557,"column":2}},"279":{"start":{"line":542,"column":2},"end":{"line":542,"column":29}},"280":{"start":{"line":543,"column":2},"end":{"line":543,"column":45}},"281":{"start":{"line":544,"column":2},"end":{"line":556,"column":5}},"282":{"start":{"line":545,"column":4},"end":{"line":545,"column":34}},"283":{"start":{"line":545,"column":13},"end":{"line":545,"column":34}},"284":{"start":{"line":547,"column":4},"end":{"line":547,"column":46}},"285":{"start":{"line":548,"column":4},"end":{"line":549,"column":68}},"286":{"start":{"line":549,"column":6},"end":{"line":549,"column":68}},"287":{"start":{"line":551,"column":4},"end":{"line":551,"column":26}},"288":{"start":{"line":552,"column":4},"end":{"line":552,"column":26}},"289":{"start":{"line":553,"column":4},"end":{"line":553,"column":50}},"290":{"start":{"line":554,"column":4},"end":{"line":554,"column":42}},"291":{"start":{"line":555,"column":4},"end":{"line":555,"column":27}},"292":{"start":{"line":586,"column":0},"end":{"line":616,"column":2}},"293":{"start":{"line":587,"column":2},"end":{"line":590,"column":3}},"294":{"start":{"line":588,"column":4},"end":{"line":588,"column":38}},"295":{"start":{"line":588,"column":15},"end":{"line":588,"column":36}},"296":{"start":{"line":589,"column":4},"end":{"line":589,"column":62}},"297":{"start":{"line":592,"column":2},"end":{"line":615,"column":3}},"298":{"start":{"line":593,"column":4},"end":{"line":593,"column":39}},"299":{"start":{"line":596,"column":4},"end":{"line":596,"column":20}},"300":{"start":{"line":597,"column":4},"end":{"line":614,"column":7}},"301":{"start":{"line":602,"column":6},"end":{"line":613,"column":7}},"302":{"start":{"line":608,"column":8},"end":{"line":608,"column":28}},"303":{"start":{"line":609,"column":8},"end":{"line":609,"column":43}},"304":{"start":{"line":612,"column":8},"end":{"line":612,"column":33}},"305":{"start":{"line":618,"column":0},"end":{"line":624,"column":2}},"306":{"start":{"line":619,"column":2},"end":{"line":619,"column":18}},"307":{"start":{"line":620,"column":2},"end":{"line":623,"column":5}},"308":{"start":{"line":621,"column":4},"end":{"line":621,"column":34}},"309":{"start":{"line":621,"column":13},"end":{"line":621,"column":34}},"310":{"start":{"line":622,"column":4},"end":{"line":622,"column":66}},"311":{"start":{"line":622,"column":43},"end":{"line":622,"column":62}},"312":{"start":{"line":626,"column":0},"end":{"line":632,"column":2}},"313":{"start":{"line":627,"column":2},"end":{"line":627,"column":18}},"314":{"start":{"line":628,"column":2},"end":{"line":629,"column":43}},"315":{"start":{"line":629,"column":4},"end":{"line":629,"column":43}},"316":{"start":{"line":631,"column":2},"end":{"line":631,"column":66}},"317":{"start":{"line":634,"column":0},"end":{"line":641,"column":2}},"318":{"start":{"line":635,"column":2},"end":{"line":636,"column":43}},"319":{"start":{"line":636,"column":4},"end":{"line":636,"column":43}},"320":{"start":{"line":638,"column":2},"end":{"line":638,"column":24}},"321":{"start":{"line":639,"column":2},"end":{"line":639,"column":23}},"322":{"start":{"line":640,"column":2},"end":{"line":640,"column":29}}},"branchMap":{"1":{"line":39,"type":"if","locations":[{"start":{"line":39,"column":4},"end":{"line":39,"column":4}},{"start":{"line":39,"column":4},"end":{"line":39,"column":4}}]},"2":{"line":41,"type":"if","locations":[{"start":{"line":41,"column":6},"end":{"line":41,"column":6}},{"start":{"line":41,"column":6},"end":{"line":41,"column":6}}]},"3":{"line":53,"type":"if","locations":[{"start":{"line":53,"column":4},"end":{"line":53,"column":4}},{"start":{"line":53,"column":4},"end":{"line":53,"column":4}}]},"4":{"line":65,"type":"if","locations":[{"start":{"line":65,"column":4},"end":{"line":65,"column":4}},{"start":{"line":65,"column":4},"end":{"line":65,"column":4}}]},"5":{"line":74,"type":"binary-expr","locations":[{"start":{"line":74,"column":14},"end":{"line":74,"column":23}},{"start":{"line":74,"column":27},"end":{"line":74,"column":35}}]},"6":{"line":86,"type":"if","locations":[{"start":{"line":86,"column":4},"end":{"line":86,"column":4}},{"start":{"line":86,"column":4},"end":{"line":86,"column":4}}]},"7":{"line":114,"type":"if","locations":[{"start":{"line":114,"column":2},"end":{"line":114,"column":2}},{"start":{"line":114,"column":2},"end":{"line":114,"column":2}}]},"8":{"line":120,"type":"binary-expr","locations":[{"start":{"line":120,"column":20},"end":{"line":120,"column":32}},{"start":{"line":120,"column":36},"end":{"line":120,"column":43}}]},"9":{"line":137,"type":"if","locations":[{"start":{"line":137,"column":4},"end":{"line":137,"column":4}},{"start":{"line":137,"column":4},"end":{"line":137,"column":4}}]},"10":{"line":145,"type":"if","locations":[{"start":{"line":145,"column":2},"end":{"line":145,"column":2}},{"start":{"line":145,"column":2},"end":{"line":145,"column":2}}]},"11":{"line":148,"type":"if","locations":[{"start":{"line":148,"column":2},"end":{"line":148,"column":2}},{"start":{"line":148,"column":2},"end":{"line":148,"column":2}}]},"12":{"line":152,"type":"if","locations":[{"start":{"line":152,"column":2},"end":{"line":152,"column":2}},{"start":{"line":152,"column":2},"end":{"line":152,"column":2}}]},"13":{"line":155,"type":"if","locations":[{"start":{"line":155,"column":4},"end":{"line":155,"column":4}},{"start":{"line":155,"column":4},"end":{"line":155,"column":4}}]},"14":{"line":155,"type":"binary-expr","locations":[{"start":{"line":155,"column":8},"end":{"line":155,"column":28}},{"start":{"line":155,"column":32},"end":{"line":155,"column":83}}]},"15":{"line":160,"type":"if","locations":[{"start":{"line":160,"column":4},"end":{"line":160,"column":4}},{"start":{"line":160,"column":4},"end":{"line":160,"column":4}}]},"16":{"line":164,"type":"if","locations":[{"start":{"line":164,"column":2},"end":{"line":164,"column":2}},{"start":{"line":164,"column":2},"end":{"line":164,"column":2}}]},"17":{"line":164,"type":"binary-expr","locations":[{"start":{"line":164,"column":6},"end":{"line":164,"column":24}},{"start":{"line":164,"column":28},"end":{"line":164,"column":60}}]},"18":{"line":179,"type":"if","locations":[{"start":{"line":179,"column":2},"end":{"line":179,"column":2}},{"start":{"line":179,"column":2},"end":{"line":179,"column":2}}]},"19":{"line":179,"type":"binary-expr","locations":[{"start":{"line":179,"column":6},"end":{"line":179,"column":14}},{"start":{"line":179,"column":18},"end":{"line":179,"column":45}}]},"20":{"line":182,"type":"if","locations":[{"start":{"line":182,"column":2},"end":{"line":182,"column":2}},{"start":{"line":182,"column":2},"end":{"line":182,"column":2}}]},"21":{"line":189,"type":"if","locations":[{"start":{"line":189,"column":2},"end":{"line":189,"column":2}},{"start":{"line":189,"column":2},"end":{"line":189,"column":2}}]},"22":{"line":208,"type":"if","locations":[{"start":{"line":208,"column":2},"end":{"line":208,"column":2}},{"start":{"line":208,"column":2},"end":{"line":208,"column":2}}]},"23":{"line":211,"type":"if","locations":[{"start":{"line":211,"column":2},"end":{"line":211,"column":2}},{"start":{"line":211,"column":2},"end":{"line":211,"column":2}}]},"24":{"line":211,"type":"binary-expr","locations":[{"start":{"line":211,"column":6},"end":{"line":211,"column":17}},{"start":{"line":211,"column":21},"end":{"line":211,"column":41}}]},"25":{"line":214,"type":"if","locations":[{"start":{"line":214,"column":7},"end":{"line":214,"column":7}},{"start":{"line":214,"column":7},"end":{"line":214,"column":7}}]},"26":{"line":226,"type":"if","locations":[{"start":{"line":226,"column":4},"end":{"line":226,"column":4}},{"start":{"line":226,"column":4},"end":{"line":226,"column":4}}]},"27":{"line":226,"type":"binary-expr","locations":[{"start":{"line":226,"column":8},"end":{"line":226,"column":26}},{"start":{"line":226,"column":30},"end":{"line":226,"column":64}}]},"28":{"line":252,"type":"if","locations":[{"start":{"line":252,"column":2},"end":{"line":252,"column":2}},{"start":{"line":252,"column":2},"end":{"line":252,"column":2}}]},"29":{"line":259,"type":"if","locations":[{"start":{"line":259,"column":2},"end":{"line":259,"column":2}},{"start":{"line":259,"column":2},"end":{"line":259,"column":2}}]},"30":{"line":260,"type":"binary-expr","locations":[{"start":{"line":260,"column":20},"end":{"line":260,"column":33}},{"start":{"line":260,"column":37},"end":{"line":260,"column":57}}]},"31":{"line":274,"type":"if","locations":[{"start":{"line":274,"column":2},"end":{"line":274,"column":2}},{"start":{"line":274,"column":2},"end":{"line":274,"column":2}}]},"32":{"line":299,"type":"if","locations":[{"start":{"line":299,"column":2},"end":{"line":299,"column":2}},{"start":{"line":299,"column":2},"end":{"line":299,"column":2}}]},"33":{"line":301,"type":"cond-expr","locations":[{"start":{"line":301,"column":28},"end":{"line":301,"column":30}},{"start":{"line":301,"column":33},"end":{"line":301,"column":64}}]},"34":{"line":303,"type":"if","locations":[{"start":{"line":303,"column":8},"end":{"line":303,"column":8}},{"start":{"line":303,"column":8},"end":{"line":303,"column":8}}]},"35":{"line":303,"type":"binary-expr","locations":[{"start":{"line":303,"column":12},"end":{"line":303,"column":16}},{"start":{"line":303,"column":20},"end":{"line":303,"column":36}}]},"36":{"line":331,"type":"if","locations":[{"start":{"line":331,"column":2},"end":{"line":331,"column":2}},{"start":{"line":331,"column":2},"end":{"line":331,"column":2}}]},"37":{"line":333,"type":"if","locations":[{"start":{"line":333,"column":2},"end":{"line":333,"column":2}},{"start":{"line":333,"column":2},"end":{"line":333,"column":2}}]},"38":{"line":334,"type":"if","locations":[{"start":{"line":334,"column":2},"end":{"line":334,"column":2}},{"start":{"line":334,"column":2},"end":{"line":334,"column":2}}]},"39":{"line":338,"type":"if","locations":[{"start":{"line":338,"column":4},"end":{"line":338,"column":4}},{"start":{"line":338,"column":4},"end":{"line":338,"column":4}}]},"40":{"line":338,"type":"binary-expr","locations":[{"start":{"line":338,"column":8},"end":{"line":338,"column":12}},{"start":{"line":338,"column":16},"end":{"line":338,"column":54}}]},"41":{"line":342,"type":"if","locations":[{"start":{"line":342,"column":8},"end":{"line":342,"column":8}},{"start":{"line":342,"column":8},"end":{"line":342,"column":8}}]},"42":{"line":345,"type":"if","locations":[{"start":{"line":345,"column":8},"end":{"line":345,"column":8}},{"start":{"line":345,"column":8},"end":{"line":345,"column":8}}]},"43":{"line":351,"type":"if","locations":[{"start":{"line":351,"column":13},"end":{"line":351,"column":13}},{"start":{"line":351,"column":13},"end":{"line":351,"column":13}}]},"44":{"line":364,"type":"if","locations":[{"start":{"line":364,"column":2},"end":{"line":364,"column":2}},{"start":{"line":364,"column":2},"end":{"line":364,"column":2}}]},"45":{"line":369,"type":"if","locations":[{"start":{"line":369,"column":4},"end":{"line":369,"column":4}},{"start":{"line":369,"column":4},"end":{"line":369,"column":4}}]},"46":{"line":382,"type":"if","locations":[{"start":{"line":382,"column":2},"end":{"line":382,"column":2}},{"start":{"line":382,"column":2},"end":{"line":382,"column":2}}]},"47":{"line":399,"type":"binary-expr","locations":[{"start":{"line":399,"column":44},"end":{"line":399,"column":47}},{"start":{"line":399,"column":51},"end":{"line":399,"column":55}}]},"48":{"line":402,"type":"binary-expr","locations":[{"start":{"line":402,"column":27},"end":{"line":402,"column":31}},{"start":{"line":402,"column":35},"end":{"line":402,"column":37}}]},"49":{"line":419,"type":"if","locations":[{"start":{"line":419,"column":2},"end":{"line":419,"column":2}},{"start":{"line":419,"column":2},"end":{"line":419,"column":2}}]},"50":{"line":420,"type":"binary-expr","locations":[{"start":{"line":420,"column":20},"end":{"line":420,"column":29}},{"start":{"line":420,"column":33},"end":{"line":420,"column":46}}]},"51":{"line":423,"type":"if","locations":[{"start":{"line":423,"column":6},"end":{"line":423,"column":6}},{"start":{"line":423,"column":6},"end":{"line":423,"column":6}}]},"52":{"line":428,"type":"binary-expr","locations":[{"start":{"line":428,"column":20},"end":{"line":428,"column":28}},{"start":{"line":428,"column":32},"end":{"line":428,"column":45}}]},"53":{"line":430,"type":"if","locations":[{"start":{"line":430,"column":6},"end":{"line":430,"column":6}},{"start":{"line":430,"column":6},"end":{"line":430,"column":6}}]},"54":{"line":458,"type":"if","locations":[{"start":{"line":458,"column":4},"end":{"line":458,"column":4}},{"start":{"line":458,"column":4},"end":{"line":458,"column":4}}]},"55":{"line":463,"type":"if","locations":[{"start":{"line":463,"column":6},"end":{"line":463,"column":6}},{"start":{"line":463,"column":6},"end":{"line":463,"column":6}}]},"56":{"line":465,"type":"if","locations":[{"start":{"line":465,"column":6},"end":{"line":465,"column":6}},{"start":{"line":465,"column":6},"end":{"line":465,"column":6}}]},"57":{"line":485,"type":"if","locations":[{"start":{"line":485,"column":2},"end":{"line":485,"column":2}},{"start":{"line":485,"column":2},"end":{"line":485,"column":2}}]},"58":{"line":487,"type":"if","locations":[{"start":{"line":487,"column":6},"end":{"line":487,"column":6}},{"start":{"line":487,"column":6},"end":{"line":487,"column":6}}]},"59":{"line":493,"type":"if","locations":[{"start":{"line":493,"column":6},"end":{"line":493,"column":6}},{"start":{"line":493,"column":6},"end":{"line":493,"column":6}}]},"60":{"line":497,"type":"if","locations":[{"start":{"line":497,"column":8},"end":{"line":497,"column":8}},{"start":{"line":497,"column":8},"end":{"line":497,"column":8}}]},"61":{"line":507,"type":"if","locations":[{"start":{"line":507,"column":2},"end":{"line":507,"column":2}},{"start":{"line":507,"column":2},"end":{"line":507,"column":2}}]},"62":{"line":509,"type":"binary-expr","locations":[{"start":{"line":509,"column":22},"end":{"line":509,"column":34}},{"start":{"line":509,"column":38},"end":{"line":509,"column":51}}]},"63":{"line":511,"type":"if","locations":[{"start":{"line":511,"column":4},"end":{"line":511,"column":4}},{"start":{"line":511,"column":4},"end":{"line":511,"column":4}}]},"64":{"line":520,"type":"if","locations":[{"start":{"line":520,"column":4},"end":{"line":520,"column":4}},{"start":{"line":520,"column":4},"end":{"line":520,"column":4}}]},"65":{"line":523,"type":"if","locations":[{"start":{"line":523,"column":6},"end":{"line":523,"column":6}},{"start":{"line":523,"column":6},"end":{"line":523,"column":6}}]},"66":{"line":527,"type":"if","locations":[{"start":{"line":527,"column":6},"end":{"line":527,"column":6}},{"start":{"line":527,"column":6},"end":{"line":527,"column":6}}]},"67":{"line":543,"type":"binary-expr","locations":[{"start":{"line":543,"column":18},"end":{"line":543,"column":26}},{"start":{"line":543,"column":30},"end":{"line":543,"column":43}}]},"68":{"line":545,"type":"if","locations":[{"start":{"line":545,"column":4},"end":{"line":545,"column":4}},{"start":{"line":545,"column":4},"end":{"line":545,"column":4}}]},"69":{"line":548,"type":"if","locations":[{"start":{"line":548,"column":4},"end":{"line":548,"column":4}},{"start":{"line":548,"column":4},"end":{"line":548,"column":4}}]},"70":{"line":554,"type":"binary-expr","locations":[{"start":{"line":554,"column":22},"end":{"line":554,"column":29}},{"start":{"line":554,"column":33},"end":{"line":554,"column":40}}]},"71":{"line":588,"type":"if","locations":[{"start":{"line":588,"column":4},"end":{"line":588,"column":4}},{"start":{"line":588,"column":4},"end":{"line":588,"column":4}}]},"72":{"line":589,"type":"binary-expr","locations":[{"start":{"line":589,"column":36},"end":{"line":589,"column":48}},{"start":{"line":589,"column":52},"end":{"line":589,"column":59}}]},"73":{"line":592,"type":"if","locations":[{"start":{"line":592,"column":2},"end":{"line":592,"column":2}},{"start":{"line":592,"column":2},"end":{"line":592,"column":2}}]},"74":{"line":602,"type":"if","locations":[{"start":{"line":602,"column":6},"end":{"line":602,"column":6}},{"start":{"line":602,"column":6},"end":{"line":602,"column":6}}]},"75":{"line":602,"type":"binary-expr","locations":[{"start":{"line":602,"column":11},"end":{"line":602,"column":14}},{"start":{"line":602,"column":19},"end":{"line":602,"column":35}},{"start":{"line":602,"column":39},"end":{"line":602,"column":55}},{"start":{"line":603,"column":9},"end":{"line":603,"column":20}},{"start":{"line":603,"column":24},"end":{"line":603,"column":63}}]},"76":{"line":621,"type":"if","locations":[{"start":{"line":621,"column":4},"end":{"line":621,"column":4}},{"start":{"line":621,"column":4},"end":{"line":621,"column":4}}]},"77":{"line":628,"type":"if","locations":[{"start":{"line":628,"column":2},"end":{"line":628,"column":2}},{"start":{"line":628,"column":2},"end":{"line":628,"column":2}}]},"78":{"line":635,"type":"if","locations":[{"start":{"line":635,"column":2},"end":{"line":635,"column":2}},{"start":{"line":635,"column":2},"end":{"line":635,"column":2}}]}}};
+}
+var __cov_0Zs5Q6XMeQ4aT8ak62bnkw = __coverage__['/Users/sergi/programming/jsftp/lib/jsftp.js'];
+__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['1']++;var Net=require('net');__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['2']++;var EventEmitter=require('events').EventEmitter;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['3']++;var Stream=require('stream');__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['4']++;var es=require('event-stream');__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['5']++;var responseHandler=require('./response');__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['6']++;var Utils=require('./utils');__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['7']++;var util=require('util');__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['8']++;var fs=require('fs');__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['9']++;var FTP_PORT=21;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['10']++;var DEBUG_MODE=false;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['11']++;var TIMEOUT=10*60*1000;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['12']++;var IDLE_TIME=30000;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['13']++;var COMMANDS=['abor','pwd','cdup','feat','noop','quit','pasv','syst','cwd','dele','list','mdtm','mkd','mode','nlst','pass','retr','rmd','rnfr','rnto','site','stat','stor','type','user','pass','xrmd','opts','chmod','size'];__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['14']++;var Cmds={};__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['15']++;COMMANDS.forEach(function(cmd){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['1']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['16']++;cmd=cmd.toLowerCase();__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['17']++;Cmds[cmd]=function(){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['2']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['18']++;var callback=function(){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['3']++;};__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['19']++;var completeCmd=cmd;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['20']++;if(arguments.length){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['1'][0]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['21']++;var args=Array.prototype.slice.call(arguments);__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['22']++;if(typeof args[args.length-1]==='function'){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['2'][0]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['23']++;callback=args.pop();}else{__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['2'][1]++;}__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['24']++;completeCmd+=' '+args.join(' ');}else{__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['1'][1]++;}__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['25']++;this.execute(completeCmd.trim(),callback);};});__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['26']++;function once(fn){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['4']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['27']++;var returnValue,called=false;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['28']++;return function(){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['5']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['29']++;if(!called){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['3'][0]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['30']++;called=true;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['31']++;returnValue=fn.apply(this,arguments);}else{__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['3'][1]++;}__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['32']++;return returnValue;};}__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['33']++;var Ftp=module.exports=function(cfg){'use strict';__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['6']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['34']++;Object.keys(cfg).forEach(function(opt){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['7']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['35']++;if(!this[opt]){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['4'][0]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['36']++;this[opt]=cfg[opt];}else{__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['4'][1]++;}},this);__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['37']++;EventEmitter.call(this);__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['38']++;this.useList=false;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['39']++;this.port=(__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['5'][0]++,this.port)||(__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['5'][1]++,FTP_PORT);__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['40']++;this.pending=[];__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['41']++;this.cmdBuffer_=[];__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['42']++;this.responseHandler=responseHandler();__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['43']++;var raw=this.raw={};__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['44']++;COMMANDS.forEach(function(cmd){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['8']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['45']++;raw[cmd]=Cmds[cmd].bind(this);},this);__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['46']++;this.on('error',function(err){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['9']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['47']++;if(DEBUG_MODE===true){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['6'][0]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['48']++;console.log(err);}else{__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['6'][1]++;}});__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['49']++;this._createSocket(this.port,this.host);};__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['50']++;util.inherits(Ftp,EventEmitter);__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['51']++;Ftp.prototype._socketOnTimeout=function(){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['10']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['52']++;this.emit('timeout',errString);__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['53']++;this.pipeline.pause();__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['54']++;this.destroy();};__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['55']++;Ftp.prototype._socketOnError=function(err){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['11']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['56']++;var errString='Error on ftp socket: '+err;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['57']++;this.emit('error',errString);__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['58']++;this.pipeline.pause();};__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['59']++;Ftp.prototype._socketOnConnect=function(){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['12']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['60']++;this.emit('connect',this.socket);__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['61']++;this.connecting=false;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['62']++;this.pipeline.resume();};__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['63']++;Ftp.prototype._createSocket=function(port,host){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['13']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['64']++;if(this.socket){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['7'][0]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['65']++;this.socket.destroy();}else{__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['7'][1]++;}__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['66']++;this.connecting=true;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['67']++;this.authenticated=false;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['68']++;var socket=this.socket=Net.createConnection(port,host);__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['69']++;socket.setTimeout((__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['8'][0]++,this.timeout)||(__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['8'][1]++,TIMEOUT),this._socketOnTimeout.bind(this));__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['70']++;socket.on('error',this._socketOnError.bind(this));__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['71']++;socket.on('connect',this._socketOnConnect.bind(this));__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['72']++;this._createStreams(this.socket);__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['73']++;this.pipeline.pause();};__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['74']++;Ftp.prototype._createStreams=function(socket){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['14']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['75']++;this.pipeline=es.pipeline(socket,es.split(),es.mapSync(this.responseHandler));__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['76']++;var self=this;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['77']++;this.pipeline.on('data',function(data){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['15']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['78']++;if(DEBUG_MODE===true){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['9'][0]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['79']++;console.log(' ',data.code,data.text);}else{__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['9'][1]++;}__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['80']++;self.parseResponse.call(self,data);});};__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['81']++;Ftp.prototype.parseResponse=function(data){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['16']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['82']++;if(!this.cmdBuffer_.length){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['10'][0]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['83']++;return;}else{__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['10'][1]++;}__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['84']++;if([220].indexOf(data.code)>-1){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['11'][0]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['85']++;return;}else{__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['11'][1]++;}__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['86']++;var nextCmd=this.cmdBuffer_[0][1];__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['87']++;if(Utils.isMark(data.code)){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['12'][0]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['88']++;if((__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['14'][0]++,!nextCmd.expectsMark)||(__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['14'][1]++,nextCmd.expectsMark.marks.indexOf(data.code)===-1)){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['13'][0]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['89']++;return;}else{__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['13'][1]++;}__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['90']++;if(nextCmd.expectsMark.ignore){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['15'][0]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['91']++;this.ignoreCmdCode=nextCmd.expectsMark.ignore;}else{__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['15'][1]++;}}else{__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['12'][1]++;}__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['92']++;if((__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['17'][0]++,this.ignoreCmdCode)&&(__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['17'][1]++,this.ignoreCmdCode===data.code)){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['16'][0]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['93']++;this.ignoreCmdCode=null;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['94']++;return;}else{__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['16'][1]++;}__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['95']++;this.parse([data,this.cmdBuffer_.shift()]);};__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['96']++;Ftp.prototype.send=function(command){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['17']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['97']++;if((__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['19'][0]++,!command)||(__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['19'][1]++,typeof command!=='string')){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['18'][0]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['98']++;return;}else{__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['18'][1]++;}__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['99']++;if(DEBUG_MODE===true){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['20'][0]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['100']++;console.log('\nSEND',command,this.cmdBuffer_,'\n');}else{__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['20'][1]++;}__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['101']++;this.pipeline.write(command+'\r\n');};__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['102']++;Ftp.prototype.nextCmd=function(){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['18']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['103']++;if(this.cmdBuffer_[0]){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['21'][0]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['104']++;this.send(this.cmdBuffer_[0][0]);}else{__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['21'][1]++;}};__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['105']++;Ftp.prototype.execute=function(action,callback){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['19']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['106']++;if(!callback){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['22'][0]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['107']++;callback=function(){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['20']++;};}else{__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['22'][1]++;}__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['108']++;var self=this;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['109']++;if((__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['24'][0]++,this.socket)&&(__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['24'][1]++,this.socket.writable)){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['23'][0]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['110']++;execute();}else{__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['23'][1]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['111']++;if(!this.connecting){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['25'][0]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['112']++;this.authenticated=false;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['113']++;this.once('connect',execute);__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['114']++;this._createSocket(this.port,this.host);}else{__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['25'][1]++;}}__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['115']++;function execute(){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['21']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['116']++;function executeCmd(){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['22']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['117']++;self.cmdBuffer_.push([action,callback]);__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['118']++;self.nextCmd();}__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['119']++;if((__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['27'][0]++,self.authenticated)||(__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['27'][1]++,/feat|syst|user|pass/.test(action))){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['26'][0]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['120']++;executeCmd();}else{__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['26'][1]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['121']++;self.getFeatures(function(){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['23']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['122']++;self.auth(self.user,self.pass,executeCmd);});}}};__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['123']++;Ftp.prototype.parse=function(action){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['24']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['124']++;var response=action[0];__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['125']++;var command=action[1];__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['126']++;var cb=command[1];__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['127']++;if(!response){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['28'][0]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['128']++;cb(new Error('FTP response not defined'));}else{__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['28'][1]++;}__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['129']++;var err=null;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['130']++;if(response.code>399){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['29'][0]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['131']++;err=new Error((__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['30'][0]++,response.text)||(__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['30'][1]++,'Unknown FTP error.'));__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['132']++;err.code=response.code;}else{__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['29'][1]++;}__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['133']++;cb(err,response);};__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['134']++;Ftp.prototype.hasFeat=function(feature){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['25']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['135']++;if(feature){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['31'][0]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['136']++;return this.features.indexOf(feature.toLowerCase())>-1;}else{__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['31'][1]++;}__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['137']++;return false;};__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['138']++;Ftp.prototype._parseFeats=function(features){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['26']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['139']++;return features.split(/\r\n|\n/).slice(1,-1).map(function(feat){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['27']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['140']++;return/^\s*(\w*)\s*/.exec(feat)[1].trim().toLowerCase();});};__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['141']++;Ftp.prototype.getFeatures=function(callback){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['28']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['142']++;var self=this;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['143']++;if(!this.features){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['32'][0]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['144']++;this.raw.feat(function(err,response){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['29']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['145']++;self.features=err?(__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['33'][0]++,[]):(__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['33'][1]++,self._parseFeats(response.text));__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['146']++;self.raw.syst(function(err,res){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['30']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['147']++;if((__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['35'][0]++,!err)&&(__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['35'][1]++,res.code===215)){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['34'][0]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['148']++;self.system=res.text.toLowerCase();}else{__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['34'][1]++;}__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['149']++;callback(null,self.features);});});}else{__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['32'][1]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['150']++;callback(null,self.features);}};__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['151']++;Ftp.prototype.auth=function(user,pass,callback){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['31']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['152']++;this.pending.push(callback);__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['153']++;var self=this;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['154']++;function notifyAll(err,res){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['32']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['155']++;var cb;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['156']++;while(cb=self.pending.shift()){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['157']++;cb(err,res);}}__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['158']++;if(this.authenticating){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['36'][0]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['159']++;return;}else{__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['36'][1]++;}__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['160']++;if(!user){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['37'][0]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['161']++;user='anonymous';}else{__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['37'][1]++;}__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['162']++;if(!pass){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['38'][0]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['163']++;pass='@anonymous';}else{__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['38'][1]++;}__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['164']++;this.authenticating=true;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['165']++;self.raw.user(user,function(err,res){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['33']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['166']++;if((__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['40'][0]++,!err)&&(__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['40'][1]++,[230,331,332].indexOf(res.code)>-1)){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['39'][0]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['167']++;self.raw.pass(pass,function(err,res){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['34']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['168']++;self.authenticating=false;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['169']++;if(err){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['41'][0]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['170']++;notifyAll(new Error('Login not accepted'));}else{__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['41'][1]++;}__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['171']++;if([230,202].indexOf(res.code)>-1){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['42'][0]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['172']++;self.authenticated=true;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['173']++;self.user=user;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['174']++;self.pass=pass;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['175']++;self.raw.type('I',function(){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['35']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['176']++;notifyAll(null,res);});}else{__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['42'][1]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['177']++;if(res.code===332){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['43'][0]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['178']++;self.raw.acct('');}else{__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['43'][1]++;}}});}else{__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['39'][1]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['179']++;self.authenticating=false;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['180']++;notifyAll(new Error('Login not accepted'));}});};__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['181']++;Ftp.prototype.setType=function(type,callback){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['36']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['182']++;if(this.type===type){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['44'][0]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['183']++;callback(null);}else{__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['44'][1]++;}__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['184']++;var self=this;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['185']++;this.raw.type(type,function(err,data){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['37']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['186']++;if(!err){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['45'][0]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['187']++;self.type=type;}else{__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['45'][1]++;}__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['188']++;callback(err,data);});};__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['189']++;Ftp.prototype.list=function(path,callback){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['38']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['190']++;if(arguments.length===1){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['46'][0]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['191']++;callback=arguments[0];__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['192']++;path='';}else{__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['46'][1]++;}__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['193']++;var self=this;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['194']++;var cb=function(err,listing){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['39']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['195']++;self.setType('I',once(function(){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['40']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['196']++;callback(err,listing);}));};__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['197']++;cb.expectsMark={marks:[125,150],ignore:226};__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['198']++;var listing='';__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['199']++;this.setType('A',function(){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['41']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['200']++;self.getPasvSocket(function(err,socket){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['42']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['201']++;socket.on('data',function(data){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['43']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['202']++;listing+=data;});__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['203']++;socket.on('close',function(err){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['44']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['204']++;cb((__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['47'][0]++,err)||(__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['47'][1]++,null),listing);});__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['205']++;socket.on('error',cb);__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['206']++;self.send('list '+((__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['48'][0]++,path)||(__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['48'][1]++,'')));});});};__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['207']++;Ftp.prototype.get=function(remotePath,localPath,callback){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['45']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['208']++;if(arguments.length===2){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['49'][0]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['209']++;callback=once((__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['50'][0]++,localPath)||(__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['50'][1]++,function(){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['46']++;}));__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['210']++;this.getGetSocket(remotePath,function(err,socket){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['47']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['211']++;if(err){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['51'][0]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['212']++;return callback(err);}else{__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['51'][1]++;}__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['213']++;callback(err,socket);});}else{__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['49'][1]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['214']++;callback=once((__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['52'][0]++,callback)||(__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['52'][1]++,function(){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['48']++;}));__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['215']++;this.getGetSocket(remotePath,function(err,socket){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['49']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['216']++;if(err){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['53'][0]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['217']++;onError(err);}else{__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['53'][1]++;}__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['218']++;function onError(err){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['50']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['219']++;console.error('There was an error transferring the file.');__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['220']++;callback(err);}__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['221']++;var writeStream=fs.createWriteStream(localPath);__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['222']++;writeStream.on('error',onError);__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['223']++;socket.on('end',function(){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['51']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['224']++;callback(null);});__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['225']++;socket.pipe(writeStream);__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['226']++;socket.resume();});}};__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['227']++;Ftp.prototype.getGetSocket=function(path,callback){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['52']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['228']++;var self=this;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['229']++;callback=once(callback);__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['230']++;this.getPasvSocket(function(err,socket){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['53']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['231']++;if(err){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['54'][0]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['232']++;return cmdCallback(err);}else{__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['54'][1]++;}__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['233']++;socket.pause();__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['234']++;function cmdCallback(err,res){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['54']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['235']++;if(err){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['55'][0]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['236']++;return callback(err);}else{__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['55'][1]++;}__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['237']++;if(res.code===150){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['56'][0]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['238']++;callback(null,socket);}else{__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['56'][1]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['239']++;callback(new Error('Unexpected command '+res.text));}}__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['240']++;cmdCallback.expectsMark={marks:[125,150],ignore:226};__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['241']++;self.execute('retr '+path,cmdCallback);});};__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['242']++;Ftp.prototype.put=function(from,to,callback){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['55']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['243']++;if(from instanceof Buffer){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['57'][0]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['244']++;this.getPutSocket(to,function(err,socket){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['56']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['245']++;if(!err){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['58'][0]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['246']++;socket.end(from);}else{__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['58'][1]++;}},callback);}else{__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['57'][1]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['247']++;var self=this;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['248']++;fs.exists(from,function(exists){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['57']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['249']++;if(!exists){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['59'][0]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['250']++;return callback(new Error('Local file doesn\'t exist.'));}else{__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['59'][1]++;}__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['251']++;self.getPutSocket(to,function(err,socket){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['58']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['252']++;if(!err){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['60'][0]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['253']++;var origin=fs.createReadStream(from,{bufferSize:4*1024});__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['254']++;origin.pipe(socket);}else{__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['60'][1]++;}},callback);});}};__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['255']++;Ftp.prototype.getPutSocket=function(path,callback,doneCallback){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['59']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['256']++;if(!callback){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['61'][0]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['257']++;throw new Error('A callback argument is required.');}else{__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['61'][1]++;}__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['258']++;doneCallback=once((__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['62'][0]++,doneCallback)||(__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['62'][1]++,function(){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['60']++;}));__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['259']++;var _callback=once(function(err,_socket){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['61']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['260']++;if(err){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['63'][0]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['261']++;callback(err);__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['262']++;return doneCallback(err);}else{__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['63'][1]++;}__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['263']++;return callback(err,_socket);});__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['264']++;var self=this;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['265']++;this.getPasvSocket(function(err,socket){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['62']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['266']++;if(err){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['64'][0]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['267']++;return _callback(err);}else{__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['64'][1]++;}__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['268']++;var putCallback=once(function putCallback(err,res){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['63']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['269']++;if(err){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['65'][0]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['270']++;return _callback(err);}else{__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['65'][1]++;}__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['271']++;if(res.code===150){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['66'][0]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['272']++;socket.on('close',doneCallback);__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['273']++;socket.on('error',doneCallback);__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['274']++;_callback(null,socket);}else{__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['66'][1]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['275']++;return _callback(new Error('Unexpected command '+res.text));}});__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['276']++;putCallback.expectsMark={marks:[125,150],ignore:226};__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['277']++;self.execute('stor '+path,putCallback);});};__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['278']++;Ftp.prototype.getPasvSocket=function(callback){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['64']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['279']++;var timeout=this.timeout;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['280']++;callback=once((__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['67'][0]++,callback)||(__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['67'][1]++,function(){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['65']++;}));__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['281']++;this.execute('pasv',function(err,res){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['66']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['282']++;if(err){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['68'][0]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['283']++;return callback(err);}else{__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['68'][1]++;}__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['284']++;var pasvRes=Utils.getPasvPort(res.text);__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['285']++;if(pasvRes===false){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['69'][0]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['286']++;return callback(new Error('PASV: Bad host/port combination'));}else{__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['69'][1]++;}__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['287']++;var host=pasvRes[0];__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['288']++;var port=pasvRes[1];__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['289']++;var socket=Net.createConnection(port,host);__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['290']++;socket.setTimeout((__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['70'][0]++,timeout)||(__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['70'][1]++,TIMEOUT));__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['291']++;callback(null,socket);});};__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['292']++;Ftp.prototype.ls=function(filePath,callback){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['67']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['293']++;function entriesToList(err,entries){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['68']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['294']++;if(err){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['71'][0]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['295']++;return callback(err);}else{__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['71'][1]++;}__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['296']++;callback(null,Utils.parseEntry((__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['72'][0]++,entries.text)||(__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['72'][1]++,entries)));}__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['297']++;if(this.useList){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['73'][0]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['298']++;this.list(filePath,entriesToList);}else{__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['73'][1]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['299']++;var self=this;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['300']++;this.raw.stat(filePath,function(err,data){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['69']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['301']++;if((__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['75'][0]++,err)&&((__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['75'][1]++,err.code===502)||(__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['75'][2]++,err.code===500))||(__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['75'][3]++,self.system)&&(__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['75'][4]++,self.system.indexOf('hummingbird')>-1)){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['74'][0]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['302']++;self.useList=true;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['303']++;self.list(filePath,entriesToList);}else{__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['74'][1]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['304']++;entriesToList(err,data);}});}};__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['305']++;Ftp.prototype.rename=function(from,to,callback){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['70']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['306']++;var self=this;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['307']++;this.raw.rnfr(from,function(err,res){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['71']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['308']++;if(err){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['76'][0]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['309']++;return callback(err);}else{__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['76'][1]++;}__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['310']++;self.raw.rnto(to,function(err,res){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['72']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['311']++;callback(err,res);});});};__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['312']++;Ftp.prototype.keepAlive=function(){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['73']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['313']++;var self=this;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['314']++;if(this._keepAliveInterval){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['77'][0]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['315']++;clearInterval(this._keepAliveInterval);}else{__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['77'][1]++;}__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['316']++;this._keepAliveInterval=setInterval(self.raw.noop,IDLE_TIME);};__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['317']++;Ftp.prototype.destroy=function(){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.f['74']++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['318']++;if(this._keepAliveInterval){__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['78'][0]++;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['319']++;clearInterval(this._keepAliveInterval);}else{__cov_0Zs5Q6XMeQ4aT8ak62bnkw.b['78'][1]++;}__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['320']++;this.socket.destroy();__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['321']++;this.features=null;__cov_0Zs5Q6XMeQ4aT8ak62bnkw.s['322']++;this.authenticated=false;};
diff --git a/node_modules/jsftp/lib/lib/response.js b/node_modules/jsftp/lib/lib/response.js
new file mode 100644
index 0000000..e660f48
--- /dev/null
+++ b/node_modules/jsftp/lib/lib/response.js
@@ -0,0 +1,6 @@
+if (typeof __coverage__ === 'undefined') { __coverage__ = {}; }
+if (!__coverage__['/Users/sergi/programming/jsftp/lib/response.js']) {
+ __coverage__['/Users/sergi/programming/jsftp/lib/response.js'] = {"path":"/Users/sergi/programming/jsftp/lib/response.js","s":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0},"b":{"1":[0,0],"2":[0,0],"3":[0,0],"4":[0,0],"5":[0,0],"6":[0,0]},"f":{"1":0,"2":0},"fnMap":{"1":{"name":"responseHandler","line":12,"loc":{"start":{"line":12,"column":0},"end":{"line":12,"column":27}}},"2":{"name":"(anonymous_2)","line":16,"loc":{"start":{"line":16,"column":9},"end":{"line":16,"column":24}}}},"statementMap":{"1":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}},"2":{"start":{"line":3,"column":0},"end":{"line":3,"column":31}},"3":{"start":{"line":4,"column":0},"end":{"line":4,"column":28}},"4":{"start":{"line":12,"column":0},"end":{"line":60,"column":1}},"5":{"start":{"line":13,"column":2},"end":{"line":13,"column":18}},"6":{"start":{"line":14,"column":2},"end":{"line":14,"column":22}},"7":{"start":{"line":16,"column":2},"end":{"line":60,"column":0}},"8":{"start":{"line":17,"column":4},"end":{"line":17,"column":38}},"9":{"start":{"line":18,"column":4},"end":{"line":18,"column":17}},"10":{"start":{"line":20,"column":4},"end":{"line":20,"column":13}},"11":{"start":{"line":21,"column":4},"end":{"line":58,"column":5}},"12":{"start":{"line":22,"column":6},"end":{"line":22,"column":40}},"13":{"start":{"line":24,"column":6},"end":{"line":32,"column":7}},"14":{"start":{"line":25,"column":8},"end":{"line":25,"column":26}},"15":{"start":{"line":27,"column":8},"end":{"line":31,"column":9}},"16":{"start":{"line":28,"column":10},"end":{"line":28,"column":35}},"17":{"start":{"line":29,"column":10},"end":{"line":29,"column":22}},"18":{"start":{"line":30,"column":10},"end":{"line":30,"column":26}},"19":{"start":{"line":34,"column":6},"end":{"line":34,"column":40}},"20":{"start":{"line":37,"column":6},"end":{"line":56,"column":7}},"21":{"start":{"line":38,"column":8},"end":{"line":38,"column":48}},"22":{"start":{"line":40,"column":11},"end":{"line":56,"column":7}},"23":{"start":{"line":57,"column":6},"end":{"line":57,"column":35}},"24":{"start":{"line":62,"column":0},"end":{"line":62,"column":33}}},"branchMap":{"1":{"line":21,"type":"if","locations":[{"start":{"line":21,"column":4},"end":{"line":21,"column":4}},{"start":{"line":21,"column":4},"end":{"line":21,"column":4}}]},"2":{"line":24,"type":"if","locations":[{"start":{"line":24,"column":6},"end":{"line":24,"column":6}},{"start":{"line":24,"column":6},"end":{"line":24,"column":6}}]},"3":{"line":27,"type":"if","locations":[{"start":{"line":27,"column":8},"end":{"line":27,"column":8}},{"start":{"line":27,"column":8},"end":{"line":27,"column":8}}]},"4":{"line":37,"type":"if","locations":[{"start":{"line":37,"column":6},"end":{"line":37,"column":6}},{"start":{"line":37,"column":6},"end":{"line":37,"column":6}}]},"5":{"line":37,"type":"binary-expr","locations":[{"start":{"line":37,"column":10},"end":{"line":37,"column":24}},{"start":{"line":37,"column":29},"end":{"line":37,"column":59}}]},"6":{"line":40,"type":"if","locations":[{"start":{"line":40,"column":11},"end":{"line":40,"column":11}},{"start":{"line":40,"column":11},"end":{"line":40,"column":11}}]}}};
+}
+var __cov_Cbo7IaZZ3Ln4aLUw25DLOQ = __coverage__['/Users/sergi/programming/jsftp/lib/response.js'];
+__cov_Cbo7IaZZ3Ln4aLUw25DLOQ.s['1']++;'use strict';__cov_Cbo7IaZZ3Ln4aLUw25DLOQ.s['2']++;var RE_RES=/^(\d\d\d)\s(.*)/;__cov_Cbo7IaZZ3Ln4aLUw25DLOQ.s['3']++;var RE_MULTI=/^(\d\d\d)-/;__cov_Cbo7IaZZ3Ln4aLUw25DLOQ.s['4']++;function responseHandler(){__cov_Cbo7IaZZ3Ln4aLUw25DLOQ.f['1']++;__cov_Cbo7IaZZ3Ln4aLUw25DLOQ.s['5']++;var buffer=[];__cov_Cbo7IaZZ3Ln4aLUw25DLOQ.s['6']++;var currentCode=0;__cov_Cbo7IaZZ3Ln4aLUw25DLOQ.s['7']++;return function(line){__cov_Cbo7IaZZ3Ln4aLUw25DLOQ.f['2']++;__cov_Cbo7IaZZ3Ln4aLUw25DLOQ.s['8']++;var simpleRes=RE_RES.exec(line);__cov_Cbo7IaZZ3Ln4aLUw25DLOQ.s['9']++;var multiRes;__cov_Cbo7IaZZ3Ln4aLUw25DLOQ.s['10']++;var code;__cov_Cbo7IaZZ3Ln4aLUw25DLOQ.s['11']++;if(simpleRes){__cov_Cbo7IaZZ3Ln4aLUw25DLOQ.b['1'][0]++;__cov_Cbo7IaZZ3Ln4aLUw25DLOQ.s['12']++;code=parseInt(simpleRes[1],10);__cov_Cbo7IaZZ3Ln4aLUw25DLOQ.s['13']++;if(buffer.length){__cov_Cbo7IaZZ3Ln4aLUw25DLOQ.b['2'][0]++;__cov_Cbo7IaZZ3Ln4aLUw25DLOQ.s['14']++;buffer.push(line);__cov_Cbo7IaZZ3Ln4aLUw25DLOQ.s['15']++;if(currentCode===code){__cov_Cbo7IaZZ3Ln4aLUw25DLOQ.b['3'][0]++;__cov_Cbo7IaZZ3Ln4aLUw25DLOQ.s['16']++;line=buffer.join('\n');__cov_Cbo7IaZZ3Ln4aLUw25DLOQ.s['17']++;buffer=[];__cov_Cbo7IaZZ3Ln4aLUw25DLOQ.s['18']++;currentCode=0;}else{__cov_Cbo7IaZZ3Ln4aLUw25DLOQ.b['3'][1]++;}}else{__cov_Cbo7IaZZ3Ln4aLUw25DLOQ.b['2'][1]++;}__cov_Cbo7IaZZ3Ln4aLUw25DLOQ.s['19']++;return{code:code,text:line};}else{__cov_Cbo7IaZZ3Ln4aLUw25DLOQ.b['1'][1]++;__cov_Cbo7IaZZ3Ln4aLUw25DLOQ.s['20']++;if((__cov_Cbo7IaZZ3Ln4aLUw25DLOQ.b['5'][0]++,!buffer.length)&&(__cov_Cbo7IaZZ3Ln4aLUw25DLOQ.b['5'][1]++,multiRes=RE_MULTI.exec(line))){__cov_Cbo7IaZZ3Ln4aLUw25DLOQ.b['4'][0]++;__cov_Cbo7IaZZ3Ln4aLUw25DLOQ.s['21']++;currentCode=parseInt(multiRes[1],10);}else{__cov_Cbo7IaZZ3Ln4aLUw25DLOQ.b['4'][1]++;__cov_Cbo7IaZZ3Ln4aLUw25DLOQ.s['22']++;if(buffer.length){__cov_Cbo7IaZZ3Ln4aLUw25DLOQ.b['6'][0]++;}else{__cov_Cbo7IaZZ3Ln4aLUw25DLOQ.b['6'][1]++;}}__cov_Cbo7IaZZ3Ln4aLUw25DLOQ.s['23']++;buffer.push(line.toString());}};}__cov_Cbo7IaZZ3Ln4aLUw25DLOQ.s['24']++;module.exports=responseHandler;
diff --git a/node_modules/jsftp/lib/lib/utils.js b/node_modules/jsftp/lib/lib/utils.js
new file mode 100644
index 0000000..35ed10b
--- /dev/null
+++ b/node_modules/jsftp/lib/lib/utils.js
@@ -0,0 +1,6 @@
+if (typeof __coverage__ === 'undefined') { __coverage__ = {}; }
+if (!__coverage__['/Users/sergi/programming/jsftp/lib/utils.js']) {
+ __coverage__['/Users/sergi/programming/jsftp/lib/utils.js'] = {"path":"/Users/sergi/programming/jsftp/lib/utils.js","s":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0},"b":{"1":[0,0],"2":[0,0],"3":[0,0],"4":[0,0,0],"5":[0,0],"6":[0,0],"7":[0,0],"8":[0,0],"9":[0,0],"10":[0,0],"11":[0,0],"12":[0,0],"13":[0,0],"14":[0,0]},"f":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0},"fnMap":{"1":{"name":"(anonymous_1)","line":10,"loc":{"start":{"line":10,"column":10},"end":{"line":10,"column":25}}},"2":{"name":"(anonymous_2)","line":21,"loc":{"start":{"line":21,"column":14},"end":{"line":21,"column":32}}},"3":{"name":"(anonymous_3)","line":26,"loc":{"start":{"line":26,"column":35},"end":{"line":26,"column":57}}},"4":{"name":"_next","line":27,"loc":{"start":{"line":27,"column":6},"end":{"line":27,"column":23}}},"5":{"name":"(anonymous_5)","line":74,"loc":{"start":{"line":74,"column":15},"end":{"line":74,"column":30}}},"6":{"name":"(anonymous_6)","line":91,"loc":{"start":{"line":91,"column":12},"end":{"line":91,"column":26}}}},"statementMap":{"1":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}},"2":{"start":{"line":2,"column":0},"end":{"line":2,"column":29}},"3":{"start":{"line":4,"column":0},"end":{"line":4,"column":31}},"4":{"start":{"line":5,"column":0},"end":{"line":5,"column":28}},"5":{"start":{"line":6,"column":0},"end":{"line":6,"column":41}},"6":{"start":{"line":8,"column":0},"end":{"line":103,"column":0}},"7":{"start":{"line":11,"column":4},"end":{"line":11,"column":30}},"8":{"start":{"line":12,"column":4},"end":{"line":12,"column":36}},"9":{"start":{"line":22,"column":4},"end":{"line":22,"column":23}},"10":{"start":{"line":23,"column":4},"end":{"line":23,"column":14}},"11":{"start":{"line":24,"column":4},"end":{"line":24,"column":20}},"12":{"start":{"line":25,"column":4},"end":{"line":25,"column":48}},"13":{"start":{"line":26,"column":4},"end":{"line":69,"column":7}},"14":{"start":{"line":27,"column":6},"end":{"line":30,"column":7}},"15":{"start":{"line":28,"column":8},"end":{"line":28,"column":15}},"16":{"start":{"line":29,"column":8},"end":{"line":29,"column":15}},"17":{"start":{"line":34,"column":6},"end":{"line":35,"column":32}},"18":{"start":{"line":35,"column":8},"end":{"line":35,"column":32}},"19":{"start":{"line":37,"column":6},"end":{"line":37,"column":27}},"20":{"start":{"line":42,"column":6},"end":{"line":45,"column":7}},"21":{"start":{"line":44,"column":8},"end":{"line":44,"column":23}},"22":{"start":{"line":47,"column":6},"end":{"line":47,"column":45}},"23":{"start":{"line":48,"column":6},"end":{"line":67,"column":7}},"24":{"start":{"line":49,"column":8},"end":{"line":55,"column":9}},"25":{"start":{"line":50,"column":10},"end":{"line":50,"column":61}},"26":{"start":{"line":51,"column":10},"end":{"line":54,"column":11}},"27":{"start":{"line":52,"column":12},"end":{"line":52,"column":62}},"28":{"start":{"line":53,"column":12},"end":{"line":53,"column":27}},"29":{"start":{"line":57,"column":8},"end":{"line":62,"column":9}},"30":{"start":{"line":58,"column":10},"end":{"line":58,"column":61}},"31":{"start":{"line":59,"column":10},"end":{"line":61,"column":11}},"32":{"start":{"line":60,"column":12},"end":{"line":60,"column":42}},"33":{"start":{"line":65,"column":8},"end":{"line":67,"column":6}},"34":{"start":{"line":66,"column":10},"end":{"line":67,"column":6}},"35":{"start":{"line":68,"column":6},"end":{"line":68,"column":14}},"36":{"start":{"line":71,"column":4},"end":{"line":71,"column":18}},"37":{"start":{"line":75,"column":4},"end":{"line":75,"column":68}},"38":{"start":{"line":76,"column":4},"end":{"line":76,"column":35}},"39":{"start":{"line":77,"column":4},"end":{"line":77,"column":29}},"40":{"start":{"line":77,"column":16},"end":{"line":77,"column":29}},"41":{"start":{"line":80,"column":4},"end":{"line":81,"column":77}},"42":{"start":{"line":92,"column":4},"end":{"line":92,"column":24}},"43":{"start":{"line":92,"column":14},"end":{"line":92,"column":24}},"44":{"start":{"line":94,"column":4},"end":{"line":94,"column":31}},"45":{"start":{"line":95,"column":4},"end":{"line":96,"column":51}},"46":{"start":{"line":96,"column":6},"end":{"line":96,"column":51}},"47":{"start":{"line":98,"column":4},"end":{"line":98,"column":15}}},"branchMap":{"1":{"line":12,"type":"binary-expr","locations":[{"start":{"line":12,"column":11},"end":{"line":12,"column":21}},{"start":{"line":12,"column":25},"end":{"line":12,"column":35}}]},"2":{"line":34,"type":"if","locations":[{"start":{"line":34,"column":6},"end":{"line":34,"column":6}},{"start":{"line":34,"column":6},"end":{"line":34,"column":6}}]},"3":{"line":42,"type":"if","locations":[{"start":{"line":42,"column":6},"end":{"line":42,"column":6}},{"start":{"line":42,"column":6},"end":{"line":42,"column":6}}]},"4":{"line":42,"type":"binary-expr","locations":[{"start":{"line":42,"column":10},"end":{"line":42,"column":40}},{"start":{"line":43,"column":8},"end":{"line":43,"column":26}},{"start":{"line":43,"column":30},"end":{"line":43,"column":50}}]},"5":{"line":48,"type":"if","locations":[{"start":{"line":48,"column":6},"end":{"line":48,"column":6}},{"start":{"line":48,"column":6},"end":{"line":48,"column":6}}]},"6":{"line":49,"type":"if","locations":[{"start":{"line":49,"column":8},"end":{"line":49,"column":8}},{"start":{"line":49,"column":8},"end":{"line":49,"column":8}}]},"7":{"line":51,"type":"if","locations":[{"start":{"line":51,"column":10},"end":{"line":51,"column":10}},{"start":{"line":51,"column":10},"end":{"line":51,"column":10}}]},"8":{"line":57,"type":"if","locations":[{"start":{"line":57,"column":8},"end":{"line":57,"column":8}},{"start":{"line":57,"column":8},"end":{"line":57,"column":8}}]},"9":{"line":57,"type":"binary-expr","locations":[{"start":{"line":57,"column":12},"end":{"line":57,"column":31}},{"start":{"line":57,"column":35},"end":{"line":57,"column":52}}]},"10":{"line":59,"type":"if","locations":[{"start":{"line":59,"column":10},"end":{"line":59,"column":10}},{"start":{"line":59,"column":10},"end":{"line":59,"column":10}}]},"11":{"line":65,"type":"if","locations":[{"start":{"line":65,"column":8},"end":{"line":65,"column":8}},{"start":{"line":65,"column":8},"end":{"line":65,"column":8}}]},"12":{"line":77,"type":"if","locations":[{"start":{"line":77,"column":4},"end":{"line":77,"column":4}},{"start":{"line":77,"column":4},"end":{"line":77,"column":4}}]},"13":{"line":92,"type":"if","locations":[{"start":{"line":92,"column":4},"end":{"line":92,"column":4}},{"start":{"line":92,"column":4},"end":{"line":92,"column":4}}]},"14":{"line":95,"type":"if","locations":[{"start":{"line":95,"column":4},"end":{"line":95,"column":4}},{"start":{"line":95,"column":4},"end":{"line":95,"column":4}}]}}};
+}
+var __cov_YktIlyn0AIPXiguqHg3XXw = __coverage__['/Users/sergi/programming/jsftp/lib/utils.js'];
+__cov_YktIlyn0AIPXiguqHg3XXw.s['1']++;var Parser=require('parse-listing');__cov_YktIlyn0AIPXiguqHg3XXw.s['2']++;var async=require('async');__cov_YktIlyn0AIPXiguqHg3XXw.s['3']++;var RE_RES=/^(\d\d\d)\s(.*)/;__cov_YktIlyn0AIPXiguqHg3XXw.s['4']++;var RE_MULTI=/^(\d\d\d)-/;__cov_YktIlyn0AIPXiguqHg3XXw.s['5']++;var RE_SERVER_RESPONSE=/^(\d\d\d)(.*)/;__cov_YktIlyn0AIPXiguqHg3XXw.s['6']++;var Utils=module.exports={isMark:function(code){__cov_YktIlyn0AIPXiguqHg3XXw.f['1']++;__cov_YktIlyn0AIPXiguqHg3XXw.s['7']++;code=parseInt(code,10);__cov_YktIlyn0AIPXiguqHg3XXw.s['8']++;return(__cov_YktIlyn0AIPXiguqHg3XXw.b['1'][0]++,code>100)&&(__cov_YktIlyn0AIPXiguqHg3XXw.b['1'][1]++,code<200);},parseEntry:function(listing){__cov_YktIlyn0AIPXiguqHg3XXw.f['2']++;__cov_YktIlyn0AIPXiguqHg3XXw.s['9']++;var t,parsedEntry;__cov_YktIlyn0AIPXiguqHg3XXw.s['10']++;var i=0;__cov_YktIlyn0AIPXiguqHg3XXw.s['11']++;var parsed=[];__cov_YktIlyn0AIPXiguqHg3XXw.s['12']++;var splitEntries=listing.split(/\r\n|\n/);__cov_YktIlyn0AIPXiguqHg3XXw.s['13']++;async.eachSeries(splitEntries,function(entry,next){__cov_YktIlyn0AIPXiguqHg3XXw.f['3']++;__cov_YktIlyn0AIPXiguqHg3XXw.s['14']++;function _next(){__cov_YktIlyn0AIPXiguqHg3XXw.f['4']++;__cov_YktIlyn0AIPXiguqHg3XXw.s['15']++;i+=1;__cov_YktIlyn0AIPXiguqHg3XXw.s['16']++;next();}__cov_YktIlyn0AIPXiguqHg3XXw.s['17']++;if(RE_MULTI.test(entry)){__cov_YktIlyn0AIPXiguqHg3XXw.b['2'][0]++;__cov_YktIlyn0AIPXiguqHg3XXw.s['18']++;entry=entry.substr(3);}else{__cov_YktIlyn0AIPXiguqHg3XXw.b['2'][1]++;}__cov_YktIlyn0AIPXiguqHg3XXw.s['19']++;entry=entry.trim();__cov_YktIlyn0AIPXiguqHg3XXw.s['20']++;if((__cov_YktIlyn0AIPXiguqHg3XXw.b['4'][0]++,RE_SERVER_RESPONSE.test(entry))||(__cov_YktIlyn0AIPXiguqHg3XXw.b['4'][1]++,RE_RES.test(entry))||(__cov_YktIlyn0AIPXiguqHg3XXw.b['4'][2]++,RE_MULTI.test(entry))){__cov_YktIlyn0AIPXiguqHg3XXw.b['3'][0]++;__cov_YktIlyn0AIPXiguqHg3XXw.s['21']++;return _next();}else{__cov_YktIlyn0AIPXiguqHg3XXw.b['3'][1]++;}__cov_YktIlyn0AIPXiguqHg3XXw.s['22']++;parsedEntry=Parser.parseEntry(entry);__cov_YktIlyn0AIPXiguqHg3XXw.s['23']++;if(parsedEntry===null){__cov_YktIlyn0AIPXiguqHg3XXw.b['5'][0]++;__cov_YktIlyn0AIPXiguqHg3XXw.s['24']++;if(splitEntries[i+1]){__cov_YktIlyn0AIPXiguqHg3XXw.b['6'][0]++;__cov_YktIlyn0AIPXiguqHg3XXw.s['25']++;t=Parser.parseEntry(entry+splitEntries[i+1]);__cov_YktIlyn0AIPXiguqHg3XXw.s['26']++;if(t!==null){__cov_YktIlyn0AIPXiguqHg3XXw.b['7'][0]++;__cov_YktIlyn0AIPXiguqHg3XXw.s['27']++;splitEntries[i+1]=entry+splitEntries[i+1];__cov_YktIlyn0AIPXiguqHg3XXw.s['28']++;return _next();}else{__cov_YktIlyn0AIPXiguqHg3XXw.b['7'][1]++;}}else{__cov_YktIlyn0AIPXiguqHg3XXw.b['6'][1]++;}__cov_YktIlyn0AIPXiguqHg3XXw.s['29']++;if((__cov_YktIlyn0AIPXiguqHg3XXw.b['9'][0]++,splitEntries[i-1])&&(__cov_YktIlyn0AIPXiguqHg3XXw.b['9'][1]++,parsed.length>0)){__cov_YktIlyn0AIPXiguqHg3XXw.b['8'][0]++;__cov_YktIlyn0AIPXiguqHg3XXw.s['30']++;t=Parser.parseEntry(splitEntries[i-1]+entry);__cov_YktIlyn0AIPXiguqHg3XXw.s['31']++;if(t!==null){__cov_YktIlyn0AIPXiguqHg3XXw.b['10'][0]++;__cov_YktIlyn0AIPXiguqHg3XXw.s['32']++;parsed[parsed.length-1]=t;}else{__cov_YktIlyn0AIPXiguqHg3XXw.b['10'][1]++;}}else{__cov_YktIlyn0AIPXiguqHg3XXw.b['8'][1]++;}}else{__cov_YktIlyn0AIPXiguqHg3XXw.b['5'][1]++;__cov_YktIlyn0AIPXiguqHg3XXw.s['33']++;if(parsedEntry){__cov_YktIlyn0AIPXiguqHg3XXw.b['11'][0]++;__cov_YktIlyn0AIPXiguqHg3XXw.s['34']++;parsed.push(parsedEntry);}else{__cov_YktIlyn0AIPXiguqHg3XXw.b['11'][1]++;}}__cov_YktIlyn0AIPXiguqHg3XXw.s['35']++;_next();});__cov_YktIlyn0AIPXiguqHg3XXw.s['36']++;return parsed;},getPasvPort:function(text){__cov_YktIlyn0AIPXiguqHg3XXw.f['5']++;__cov_YktIlyn0AIPXiguqHg3XXw.s['37']++;var RE_PASV=/([-\d]+,[-\d]+,[-\d]+,[-\d]+),([-\d]+),([-\d]+)/;__cov_YktIlyn0AIPXiguqHg3XXw.s['38']++;var match=RE_PASV.exec(text);__cov_YktIlyn0AIPXiguqHg3XXw.s['39']++;if(!match){__cov_YktIlyn0AIPXiguqHg3XXw.b['12'][0]++;__cov_YktIlyn0AIPXiguqHg3XXw.s['40']++;return false;}else{__cov_YktIlyn0AIPXiguqHg3XXw.b['12'][1]++;}__cov_YktIlyn0AIPXiguqHg3XXw.s['41']++;return[match[1].replace(/,/g,'.'),(parseInt(match[2],10)&255)*256+(parseInt(match[3],10)&255)];},sanitize:function(cmd){__cov_YktIlyn0AIPXiguqHg3XXw.f['6']++;__cov_YktIlyn0AIPXiguqHg3XXw.s['42']++;if(!cmd){__cov_YktIlyn0AIPXiguqHg3XXw.b['13'][0]++;__cov_YktIlyn0AIPXiguqHg3XXw.s['43']++;return'';}else{__cov_YktIlyn0AIPXiguqHg3XXw.b['13'][1]++;}__cov_YktIlyn0AIPXiguqHg3XXw.s['44']++;var _cmd=cmd.slice(0,5);__cov_YktIlyn0AIPXiguqHg3XXw.s['45']++;if(_cmd==='pass '){__cov_YktIlyn0AIPXiguqHg3XXw.b['14'][0]++;__cov_YktIlyn0AIPXiguqHg3XXw.s['46']++;cmd=_cmd+Array(cmd.length-5).join('*');}else{__cov_YktIlyn0AIPXiguqHg3XXw.b['14'][1]++;}__cov_YktIlyn0AIPXiguqHg3XXw.s['47']++;return cmd;}};
diff --git a/node_modules/jsftp/lib/response.js b/node_modules/jsftp/lib/response.js
new file mode 100644
index 0000000..7a5664d
--- /dev/null
+++ b/node_modules/jsftp/lib/response.js
@@ -0,0 +1,45 @@
+"use strict";
+
+var RE_RES = /^(\d\d\d)\s(.*)/;
+var RE_MULTI = /^(\d\d\d)-/;
+
+/**
+ * Receives a stream of responses from the server and filters
+ * them before pushing them back into the stream. The filtering is
+ * necessary to detect multiline responses, in which several responses from
+ * the server belong to a single command.
+ */
+function responseHandler() {
+ var buffer = [];
+ var currentCode = 0;
+
+ return function(line) {
+ var simpleRes = RE_RES.exec(line);
+ var multiRes;
+
+ var code;
+ if (simpleRes) {
+ code = parseInt(simpleRes[1], 10);
+
+ if (buffer.length) {
+ buffer.push(line);
+
+ if (currentCode === code) {
+ line = buffer.join("\n");
+ buffer = [];
+ currentCode = 0;
+ }
+ }
+
+ return { code: code, text: line };
+ }
+ else {
+ if (!buffer.length && (multiRes = RE_MULTI.exec(line))) {
+ currentCode = parseInt(multiRes[1], 10);
+ }
+ buffer.push(line.toString());
+ }
+ }
+}
+
+module.exports = responseHandler;
diff --git a/node_modules/jsftp/lib/utils.js b/node_modules/jsftp/lib/utils.js
new file mode 100644
index 0000000..d569e99
--- /dev/null
+++ b/node_modules/jsftp/lib/utils.js
@@ -0,0 +1,101 @@
+var Parser = require("parse-listing");
+var async = require("async");
+
+var RE_RES = /^(\d\d\d)\s(.*)/;
+var RE_MULTI = /^(\d\d\d)-/;
+var RE_SERVER_RESPONSE = /^(\d\d\d)(.*)/;
+
+var Utils = module.exports = {
+ // Codes from 100 to 200 are FTP marks
+ isMark: function(code) {
+ code = parseInt(code, 10);
+ return code > 100 && code < 200;
+ },
+
+ /**
+ * Parse raw output of a file listing, trying in to clean up broken listings in
+ * the process
+ * @param {String} listing Raw file listing coming from a 'list' or 'stat'
+ * @returns {Object[]}
+ */
+ parseEntry: function(listing) {
+ var t, parsedEntry;
+ var i = 0;
+ var parsed = [];
+ var splitEntries = listing.split(/\r\n|\n/);
+ async.eachSeries(splitEntries, function(entry, next) {
+ function _next() {
+ i += 1;
+ next();
+ }
+
+ // Some servers include an official code-multiline sign at the beginning of
+ // every string. We must strip it if that's the case.
+ if (RE_MULTI.test(entry))
+ entry = entry.substr(3);
+
+ entry = entry.trim();
+
+ // Filter file-listing results from 'STAT' command, since they include
+ // server responses before and after the file listing.
+ // Issue: https://github.com/sergi/jsftp/issues/3
+ if (RE_SERVER_RESPONSE.test(entry) ||
+ RE_RES.test(entry) || RE_MULTI.test(entry)) {
+ return _next();
+ }
+
+ parsedEntry = Parser.parseEntry(entry);
+ if (parsedEntry === null) {
+ if (splitEntries[i + 1]) {
+ t = Parser.parseEntry(entry + splitEntries[i + 1]);
+ if (t !== null) {
+ splitEntries[i + 1] = entry + splitEntries[i + 1];
+ return _next();
+ }
+ }
+
+ if (splitEntries[i - 1] && parsed.length > 0) {
+ t = Parser.parseEntry(splitEntries[i - 1] + entry);
+ if (t !== null) {
+ parsed[parsed.length - 1] = t;
+ }
+ }
+ }
+ else {
+ if (parsedEntry)
+ parsed.push(parsedEntry)
+ }
+ _next();
+ });
+
+ return parsed;
+ },
+
+ getPasvPort: function(text) {
+ var RE_PASV = /([-\d]+,[-\d]+,[-\d]+,[-\d]+),([-\d]+),([-\d]+)/;
+ var match = RE_PASV.exec(text);
+ if (!match) return false;
+
+ // Array containing the passive host and the port number
+ return [match[1].replace(/,/g, "."),
+ (parseInt(match[2], 10) & 255) * 256 + (parseInt(match[3], 10) & 255)];
+ },
+
+ /**
+ * Cleans up commands with potentially insecure data in them, such as
+ * passwords, personal info, etc.
+ *
+ * @param cmd {String} Command to be sanitized
+ * @returns {String} Sanitized command
+ */
+ sanitize: function(cmd) {
+ if (!cmd) return "";
+
+ var _cmd = cmd.slice(0, 5);
+ if (_cmd === "pass ")
+ cmd = _cmd + Array(cmd.length - 5).join("*");
+
+ return cmd;
+ }
+}
+
diff --git a/node_modules/jsftp/node_modules/async/LICENSE b/node_modules/jsftp/node_modules/async/LICENSE
new file mode 100644
index 0000000..b7f9d50
--- /dev/null
+++ b/node_modules/jsftp/node_modules/async/LICENSE
@@ -0,0 +1,19 @@
+Copyright (c) 2010 Caolan McMahon
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/node_modules/jsftp/node_modules/async/README.md b/node_modules/jsftp/node_modules/async/README.md
new file mode 100644
index 0000000..9ff1acf
--- /dev/null
+++ b/node_modules/jsftp/node_modules/async/README.md
@@ -0,0 +1,1414 @@
+# Async.js
+
+Async is a utility module which provides straight-forward, powerful functions
+for working with asynchronous JavaScript. Although originally designed for
+use with [node.js](http://nodejs.org), it can also be used directly in the
+browser. Also supports [component](https://github.com/component/component).
+
+Async provides around 20 functions that include the usual 'functional'
+suspects (map, reduce, filter, each…) as well as some common patterns
+for asynchronous control flow (parallel, series, waterfall…). All these
+functions assume you follow the node.js convention of providing a single
+callback as the last argument of your async function.
+
+
+## Quick Examples
+
+```javascript
+async.map(['file1','file2','file3'], fs.stat, function(err, results){
+ // results is now an array of stats for each file
+});
+
+async.filter(['file1','file2','file3'], fs.exists, function(results){
+ // results now equals an array of the existing files
+});
+
+async.parallel([
+ function(){ ... },
+ function(){ ... }
+], callback);
+
+async.series([
+ function(){ ... },
+ function(){ ... }
+]);
+```
+
+There are many more functions available so take a look at the docs below for a
+full list. This module aims to be comprehensive, so if you feel anything is
+missing please create a GitHub issue for it.
+
+## Common Pitfalls
+
+### Binding a context to an iterator
+
+This section is really about bind, not about async. If you are wondering how to
+make async execute your iterators in a given context, or are confused as to why
+a method of another library isn't working as an iterator, study this example:
+
+```js
+// Here is a simple object with an (unnecessarily roundabout) squaring method
+var AsyncSquaringLibrary = {
+ squareExponent: 2,
+ square: function(number, callback){
+ var result = Math.pow(number, this.squareExponent);
+ setTimeout(function(){
+ callback(null, result);
+ }, 200);
+ }
+};
+
+async.map([1, 2, 3], AsyncSquaringLibrary.square, function(err, result){
+ // result is [NaN, NaN, NaN]
+ // This fails because the `this.squareExponent` expression in the square
+ // function is not evaluated in the context of AsyncSquaringLibrary, and is
+ // therefore undefined.
+});
+
+async.map([1, 2, 3], AsyncSquaringLibrary.square.bind(AsyncSquaringLibrary), function(err, result){
+ // result is [1, 4, 9]
+ // With the help of bind we can attach a context to the iterator before
+ // passing it to async. Now the square function will be executed in its
+ // 'home' AsyncSquaringLibrary context and the value of `this.squareExponent`
+ // will be as expected.
+});
+```
+
+## Download
+
+The source is available for download from
+[GitHub](http://github.com/caolan/async).
+Alternatively, you can install using Node Package Manager (npm):
+
+ npm install async
+
+__Development:__ [async.js](https://github.com/caolan/async/raw/master/lib/async.js) - 29.6kb Uncompressed
+
+## In the Browser
+
+So far it's been tested in IE6, IE7, IE8, FF3.6 and Chrome 5. Usage:
+
+```html
+
+
+```
+
+## Documentation
+
+### Collections
+
+* [each](#each)
+* [map](#map)
+* [filter](#filter)
+* [reject](#reject)
+* [reduce](#reduce)
+* [detect](#detect)
+* [sortBy](#sortBy)
+* [some](#some)
+* [every](#every)
+* [concat](#concat)
+
+### Control Flow
+
+* [series](#series)
+* [parallel](#parallel)
+* [whilst](#whilst)
+* [doWhilst](#doWhilst)
+* [until](#until)
+* [doUntil](#doUntil)
+* [forever](#forever)
+* [waterfall](#waterfall)
+* [compose](#compose)
+* [applyEach](#applyEach)
+* [queue](#queue)
+* [cargo](#cargo)
+* [auto](#auto)
+* [iterator](#iterator)
+* [apply](#apply)
+* [nextTick](#nextTick)
+* [times](#times)
+* [timesSeries](#timesSeries)
+
+### Utils
+
+* [memoize](#memoize)
+* [unmemoize](#unmemoize)
+* [log](#log)
+* [dir](#dir)
+* [noConflict](#noConflict)
+
+
+## Collections
+
+
+
+### each(arr, iterator, callback)
+
+Applies an iterator function to each item in an array, in parallel.
+The iterator is called with an item from the list and a callback for when it
+has finished. If the iterator passes an error to this callback, the main
+callback for the each function is immediately called with the error.
+
+Note, that since this function applies the iterator to each item in parallel
+there is no guarantee that the iterator functions will complete in order.
+
+__Arguments__
+
+* arr - An array to iterate over.
+* iterator(item, callback) - A function to apply to each item in the array.
+ The iterator is passed a callback(err) which must be called once it has
+ completed. If no error has occured, the callback should be run without
+ arguments or with an explicit null argument.
+* callback(err) - A callback which is called after all the iterator functions
+ have finished, or an error has occurred.
+
+__Example__
+
+```js
+// assuming openFiles is an array of file names and saveFile is a function
+// to save the modified contents of that file:
+
+async.each(openFiles, saveFile, function(err){
+ // if any of the saves produced an error, err would equal that error
+});
+```
+
+---------------------------------------
+
+
+
+### eachSeries(arr, iterator, callback)
+
+The same as each only the iterator is applied to each item in the array in
+series. The next iterator is only called once the current one has completed
+processing. This means the iterator functions will complete in order.
+
+
+---------------------------------------
+
+
+
+### eachLimit(arr, limit, iterator, callback)
+
+The same as each only no more than "limit" iterators will be simultaneously
+running at any time.
+
+Note that the items are not processed in batches, so there is no guarantee that
+ the first "limit" iterator functions will complete before any others are
+started.
+
+__Arguments__
+
+* arr - An array to iterate over.
+* limit - The maximum number of iterators to run at any time.
+* iterator(item, callback) - A function to apply to each item in the array.
+ The iterator is passed a callback(err) which must be called once it has
+ completed. If no error has occured, the callback should be run without
+ arguments or with an explicit null argument.
+* callback(err) - A callback which is called after all the iterator functions
+ have finished, or an error has occurred.
+
+__Example__
+
+```js
+// Assume documents is an array of JSON objects and requestApi is a
+// function that interacts with a rate-limited REST api.
+
+async.eachLimit(documents, 20, requestApi, function(err){
+ // if any of the saves produced an error, err would equal that error
+});
+```
+
+---------------------------------------
+
+
+### map(arr, iterator, callback)
+
+Produces a new array of values by mapping each value in the given array through
+the iterator function. The iterator is called with an item from the array and a
+callback for when it has finished processing. The callback takes 2 arguments,
+an error and the transformed item from the array. If the iterator passes an
+error to this callback, the main callback for the map function is immediately
+called with the error.
+
+Note, that since this function applies the iterator to each item in parallel
+there is no guarantee that the iterator functions will complete in order, however
+the results array will be in the same order as the original array.
+
+__Arguments__
+
+* arr - An array to iterate over.
+* iterator(item, callback) - A function to apply to each item in the array.
+ The iterator is passed a callback(err, transformed) which must be called once
+ it has completed with an error (which can be null) and a transformed item.
+* callback(err, results) - A callback which is called after all the iterator
+ functions have finished, or an error has occurred. Results is an array of the
+ transformed items from the original array.
+
+__Example__
+
+```js
+async.map(['file1','file2','file3'], fs.stat, function(err, results){
+ // results is now an array of stats for each file
+});
+```
+
+---------------------------------------
+
+
+### mapSeries(arr, iterator, callback)
+
+The same as map only the iterator is applied to each item in the array in
+series. The next iterator is only called once the current one has completed
+processing. The results array will be in the same order as the original.
+
+
+---------------------------------------
+
+
+### mapLimit(arr, limit, iterator, callback)
+
+The same as map only no more than "limit" iterators will be simultaneously
+running at any time.
+
+Note that the items are not processed in batches, so there is no guarantee that
+ the first "limit" iterator functions will complete before any others are
+started.
+
+__Arguments__
+
+* arr - An array to iterate over.
+* limit - The maximum number of iterators to run at any time.
+* iterator(item, callback) - A function to apply to each item in the array.
+ The iterator is passed a callback(err, transformed) which must be called once
+ it has completed with an error (which can be null) and a transformed item.
+* callback(err, results) - A callback which is called after all the iterator
+ functions have finished, or an error has occurred. Results is an array of the
+ transformed items from the original array.
+
+__Example__
+
+```js
+async.map(['file1','file2','file3'], 1, fs.stat, function(err, results){
+ // results is now an array of stats for each file
+});
+```
+
+---------------------------------------
+
+
+### filter(arr, iterator, callback)
+
+__Alias:__ select
+
+Returns a new array of all the values which pass an async truth test.
+_The callback for each iterator call only accepts a single argument of true or
+false, it does not accept an error argument first!_ This is in-line with the
+way node libraries work with truth tests like fs.exists. This operation is
+performed in parallel, but the results array will be in the same order as the
+original.
+
+__Arguments__
+
+* arr - An array to iterate over.
+* iterator(item, callback) - A truth test to apply to each item in the array.
+ The iterator is passed a callback(truthValue) which must be called with a
+ boolean argument once it has completed.
+* callback(results) - A callback which is called after all the iterator
+ functions have finished.
+
+__Example__
+
+```js
+async.filter(['file1','file2','file3'], fs.exists, function(results){
+ // results now equals an array of the existing files
+});
+```
+
+---------------------------------------
+
+
+### filterSeries(arr, iterator, callback)
+
+__alias:__ selectSeries
+
+The same as filter only the iterator is applied to each item in the array in
+series. The next iterator is only called once the current one has completed
+processing. The results array will be in the same order as the original.
+
+---------------------------------------
+
+
+### reject(arr, iterator, callback)
+
+The opposite of filter. Removes values that pass an async truth test.
+
+---------------------------------------
+
+
+### rejectSeries(arr, iterator, callback)
+
+The same as reject, only the iterator is applied to each item in the array
+in series.
+
+
+---------------------------------------
+
+
+### reduce(arr, memo, iterator, callback)
+
+__aliases:__ inject, foldl
+
+Reduces a list of values into a single value using an async iterator to return
+each successive step. Memo is the initial state of the reduction. This
+function only operates in series. For performance reasons, it may make sense to
+split a call to this function into a parallel map, then use the normal
+Array.prototype.reduce on the results. This function is for situations where
+each step in the reduction needs to be async, if you can get the data before
+reducing it then it's probably a good idea to do so.
+
+__Arguments__
+
+* arr - An array to iterate over.
+* memo - The initial state of the reduction.
+* iterator(memo, item, callback) - A function applied to each item in the
+ array to produce the next step in the reduction. The iterator is passed a
+ callback(err, reduction) which accepts an optional error as its first
+ argument, and the state of the reduction as the second. If an error is
+ passed to the callback, the reduction is stopped and the main callback is
+ immediately called with the error.
+* callback(err, result) - A callback which is called after all the iterator
+ functions have finished. Result is the reduced value.
+
+__Example__
+
+```js
+async.reduce([1,2,3], 0, function(memo, item, callback){
+ // pointless async:
+ process.nextTick(function(){
+ callback(null, memo + item)
+ });
+}, function(err, result){
+ // result is now equal to the last value of memo, which is 6
+});
+```
+
+---------------------------------------
+
+
+### reduceRight(arr, memo, iterator, callback)
+
+__Alias:__ foldr
+
+Same as reduce, only operates on the items in the array in reverse order.
+
+
+---------------------------------------
+
+
+### detect(arr, iterator, callback)
+
+Returns the first value in a list that passes an async truth test. The
+iterator is applied in parallel, meaning the first iterator to return true will
+fire the detect callback with that result. That means the result might not be
+the first item in the original array (in terms of order) that passes the test.
+
+If order within the original array is important then look at detectSeries.
+
+__Arguments__
+
+* arr - An array to iterate over.
+* iterator(item, callback) - A truth test to apply to each item in the array.
+ The iterator is passed a callback(truthValue) which must be called with a
+ boolean argument once it has completed.
+* callback(result) - A callback which is called as soon as any iterator returns
+ true, or after all the iterator functions have finished. Result will be
+ the first item in the array that passes the truth test (iterator) or the
+ value undefined if none passed.
+
+__Example__
+
+```js
+async.detect(['file1','file2','file3'], fs.exists, function(result){
+ // result now equals the first file in the list that exists
+});
+```
+
+---------------------------------------
+
+
+### detectSeries(arr, iterator, callback)
+
+The same as detect, only the iterator is applied to each item in the array
+in series. This means the result is always the first in the original array (in
+terms of array order) that passes the truth test.
+
+
+---------------------------------------
+
+
+### sortBy(arr, iterator, callback)
+
+Sorts a list by the results of running each value through an async iterator.
+
+__Arguments__
+
+* arr - An array to iterate over.
+* iterator(item, callback) - A function to apply to each item in the array.
+ The iterator is passed a callback(err, sortValue) which must be called once it
+ has completed with an error (which can be null) and a value to use as the sort
+ criteria.
+* callback(err, results) - A callback which is called after all the iterator
+ functions have finished, or an error has occurred. Results is the items from
+ the original array sorted by the values returned by the iterator calls.
+
+__Example__
+
+```js
+async.sortBy(['file1','file2','file3'], function(file, callback){
+ fs.stat(file, function(err, stats){
+ callback(err, stats.mtime);
+ });
+}, function(err, results){
+ // results is now the original array of files sorted by
+ // modified date
+});
+```
+
+---------------------------------------
+
+
+### some(arr, iterator, callback)
+
+__Alias:__ any
+
+Returns true if at least one element in the array satisfies an async test.
+_The callback for each iterator call only accepts a single argument of true or
+false, it does not accept an error argument first!_ This is in-line with the
+way node libraries work with truth tests like fs.exists. Once any iterator
+call returns true, the main callback is immediately called.
+
+__Arguments__
+
+* arr - An array to iterate over.
+* iterator(item, callback) - A truth test to apply to each item in the array.
+ The iterator is passed a callback(truthValue) which must be called with a
+ boolean argument once it has completed.
+* callback(result) - A callback which is called as soon as any iterator returns
+ true, or after all the iterator functions have finished. Result will be
+ either true or false depending on the values of the async tests.
+
+__Example__
+
+```js
+async.some(['file1','file2','file3'], fs.exists, function(result){
+ // if result is true then at least one of the files exists
+});
+```
+
+---------------------------------------
+
+
+### every(arr, iterator, callback)
+
+__Alias:__ all
+
+Returns true if every element in the array satisfies an async test.
+_The callback for each iterator call only accepts a single argument of true or
+false, it does not accept an error argument first!_ This is in-line with the
+way node libraries work with truth tests like fs.exists.
+
+__Arguments__
+
+* arr - An array to iterate over.
+* iterator(item, callback) - A truth test to apply to each item in the array.
+ The iterator is passed a callback(truthValue) which must be called with a
+ boolean argument once it has completed.
+* callback(result) - A callback which is called after all the iterator
+ functions have finished. Result will be either true or false depending on
+ the values of the async tests.
+
+__Example__
+
+```js
+async.every(['file1','file2','file3'], fs.exists, function(result){
+ // if result is true then every file exists
+});
+```
+
+---------------------------------------
+
+
+### concat(arr, iterator, callback)
+
+Applies an iterator to each item in a list, concatenating the results. Returns the
+concatenated list. The iterators are called in parallel, and the results are
+concatenated as they return. There is no guarantee that the results array will
+be returned in the original order of the arguments passed to the iterator function.
+
+__Arguments__
+
+* arr - An array to iterate over
+* iterator(item, callback) - A function to apply to each item in the array.
+ The iterator is passed a callback(err, results) which must be called once it
+ has completed with an error (which can be null) and an array of results.
+* callback(err, results) - A callback which is called after all the iterator
+ functions have finished, or an error has occurred. Results is an array containing
+ the concatenated results of the iterator function.
+
+__Example__
+
+```js
+async.concat(['dir1','dir2','dir3'], fs.readdir, function(err, files){
+ // files is now a list of filenames that exist in the 3 directories
+});
+```
+
+---------------------------------------
+
+
+### concatSeries(arr, iterator, callback)
+
+Same as async.concat, but executes in series instead of parallel.
+
+
+## Control Flow
+
+
+### series(tasks, [callback])
+
+Run an array of functions in series, each one running once the previous
+function has completed. If any functions in the series pass an error to its
+callback, no more functions are run and the callback for the series is
+immediately called with the value of the error. Once the tasks have completed,
+the results are passed to the final callback as an array.
+
+It is also possible to use an object instead of an array. Each property will be
+run as a function and the results will be passed to the final callback as an object
+instead of an array. This can be a more readable way of handling results from
+async.series.
+
+
+__Arguments__
+
+* tasks - An array or object containing functions to run, each function is passed
+ a callback(err, result) it must call on completion with an error (which can
+ be null) and an optional result value.
+* callback(err, results) - An optional callback to run once all the functions
+ have completed. This function gets a results array (or object) containing all
+ the result arguments passed to the task callbacks.
+
+__Example__
+
+```js
+async.series([
+ function(callback){
+ // do some stuff ...
+ callback(null, 'one');
+ },
+ function(callback){
+ // do some more stuff ...
+ callback(null, 'two');
+ }
+],
+// optional callback
+function(err, results){
+ // results is now equal to ['one', 'two']
+});
+
+
+// an example using an object instead of an array
+async.series({
+ one: function(callback){
+ setTimeout(function(){
+ callback(null, 1);
+ }, 200);
+ },
+ two: function(callback){
+ setTimeout(function(){
+ callback(null, 2);
+ }, 100);
+ }
+},
+function(err, results) {
+ // results is now equal to: {one: 1, two: 2}
+});
+```
+
+---------------------------------------
+
+
+### parallel(tasks, [callback])
+
+Run an array of functions in parallel, without waiting until the previous
+function has completed. If any of the functions pass an error to its
+callback, the main callback is immediately called with the value of the error.
+Once the tasks have completed, the results are passed to the final callback as an
+array.
+
+It is also possible to use an object instead of an array. Each property will be
+run as a function and the results will be passed to the final callback as an object
+instead of an array. This can be a more readable way of handling results from
+async.parallel.
+
+
+__Arguments__
+
+* tasks - An array or object containing functions to run, each function is passed
+ a callback(err, result) it must call on completion with an error (which can
+ be null) and an optional result value.
+* callback(err, results) - An optional callback to run once all the functions
+ have completed. This function gets a results array (or object) containing all
+ the result arguments passed to the task callbacks.
+
+__Example__
+
+```js
+async.parallel([
+ function(callback){
+ setTimeout(function(){
+ callback(null, 'one');
+ }, 200);
+ },
+ function(callback){
+ setTimeout(function(){
+ callback(null, 'two');
+ }, 100);
+ }
+],
+// optional callback
+function(err, results){
+ // the results array will equal ['one','two'] even though
+ // the second function had a shorter timeout.
+});
+
+
+// an example using an object instead of an array
+async.parallel({
+ one: function(callback){
+ setTimeout(function(){
+ callback(null, 1);
+ }, 200);
+ },
+ two: function(callback){
+ setTimeout(function(){
+ callback(null, 2);
+ }, 100);
+ }
+},
+function(err, results) {
+ // results is now equals to: {one: 1, two: 2}
+});
+```
+
+---------------------------------------
+
+
+### parallelLimit(tasks, limit, [callback])
+
+The same as parallel only the tasks are executed in parallel with a maximum of "limit"
+tasks executing at any time.
+
+Note that the tasks are not executed in batches, so there is no guarantee that
+the first "limit" tasks will complete before any others are started.
+
+__Arguments__
+
+* tasks - An array or object containing functions to run, each function is passed
+ a callback(err, result) it must call on completion with an error (which can
+ be null) and an optional result value.
+* limit - The maximum number of tasks to run at any time.
+* callback(err, results) - An optional callback to run once all the functions
+ have completed. This function gets a results array (or object) containing all
+ the result arguments passed to the task callbacks.
+
+---------------------------------------
+
+
+### whilst(test, fn, callback)
+
+Repeatedly call fn, while test returns true. Calls the callback when stopped,
+or an error occurs.
+
+__Arguments__
+
+* test() - synchronous truth test to perform before each execution of fn.
+* fn(callback) - A function to call each time the test passes. The function is
+ passed a callback(err) which must be called once it has completed with an
+ optional error argument.
+* callback(err) - A callback which is called after the test fails and repeated
+ execution of fn has stopped.
+
+__Example__
+
+```js
+var count = 0;
+
+async.whilst(
+ function () { return count < 5; },
+ function (callback) {
+ count++;
+ setTimeout(callback, 1000);
+ },
+ function (err) {
+ // 5 seconds have passed
+ }
+);
+```
+
+---------------------------------------
+
+
+### doWhilst(fn, test, callback)
+
+The post check version of whilst. To reflect the difference in the order of operations `test` and `fn` arguments are switched. `doWhilst` is to `whilst` as `do while` is to `while` in plain JavaScript.
+
+---------------------------------------
+
+
+### until(test, fn, callback)
+
+Repeatedly call fn, until test returns true. Calls the callback when stopped,
+or an error occurs.
+
+The inverse of async.whilst.
+
+---------------------------------------
+
+
+### doUntil(fn, test, callback)
+
+Like doWhilst except the test is inverted. Note the argument ordering differs from `until`.
+
+---------------------------------------
+
+
+### forever(fn, callback)
+
+Calls the asynchronous function 'fn' repeatedly, in series, indefinitely.
+If an error is passed to fn's callback then 'callback' is called with the
+error, otherwise it will never be called.
+
+---------------------------------------
+
+
+### waterfall(tasks, [callback])
+
+Runs an array of functions in series, each passing their results to the next in
+the array. However, if any of the functions pass an error to the callback, the
+next function is not executed and the main callback is immediately called with
+the error.
+
+__Arguments__
+
+* tasks - An array of functions to run, each function is passed a
+ callback(err, result1, result2, ...) it must call on completion. The first
+ argument is an error (which can be null) and any further arguments will be
+ passed as arguments in order to the next task.
+* callback(err, [results]) - An optional callback to run once all the functions
+ have completed. This will be passed the results of the last task's callback.
+
+
+
+__Example__
+
+```js
+async.waterfall([
+ function(callback){
+ callback(null, 'one', 'two');
+ },
+ function(arg1, arg2, callback){
+ callback(null, 'three');
+ },
+ function(arg1, callback){
+ // arg1 now equals 'three'
+ callback(null, 'done');
+ }
+], function (err, result) {
+ // result now equals 'done'
+});
+```
+
+---------------------------------------
+
+### compose(fn1, fn2...)
+
+Creates a function which is a composition of the passed asynchronous
+functions. Each function consumes the return value of the function that
+follows. Composing functions f(), g() and h() would produce the result of
+f(g(h())), only this version uses callbacks to obtain the return values.
+
+Each function is executed with the `this` binding of the composed function.
+
+__Arguments__
+
+* functions... - the asynchronous functions to compose
+
+
+__Example__
+
+```js
+function add1(n, callback) {
+ setTimeout(function () {
+ callback(null, n + 1);
+ }, 10);
+}
+
+function mul3(n, callback) {
+ setTimeout(function () {
+ callback(null, n * 3);
+ }, 10);
+}
+
+var add1mul3 = async.compose(mul3, add1);
+
+add1mul3(4, function (err, result) {
+ // result now equals 15
+});
+```
+
+---------------------------------------
+
+### applyEach(fns, args..., callback)
+
+Applies the provided arguments to each function in the array, calling the
+callback after all functions have completed. If you only provide the first
+argument then it will return a function which lets you pass in the
+arguments as if it were a single function call.
+
+__Arguments__
+
+* fns - the asynchronous functions to all call with the same arguments
+* args... - any number of separate arguments to pass to the function
+* callback - the final argument should be the callback, called when all
+ functions have completed processing
+
+
+__Example__
+
+```js
+async.applyEach([enableSearch, updateSchema], 'bucket', callback);
+
+// partial application example:
+async.each(
+ buckets,
+ async.applyEach([enableSearch, updateSchema]),
+ callback
+);
+```
+
+---------------------------------------
+
+
+### applyEachSeries(arr, iterator, callback)
+
+The same as applyEach only the functions are applied in series.
+
+---------------------------------------
+
+
+### queue(worker, concurrency)
+
+Creates a queue object with the specified concurrency. Tasks added to the
+queue will be processed in parallel (up to the concurrency limit). If all
+workers are in progress, the task is queued until one is available. Once
+a worker has completed a task, the task's callback is called.
+
+__Arguments__
+
+* worker(task, callback) - An asynchronous function for processing a queued
+ task, which must call its callback(err) argument when finished, with an
+ optional error as an argument.
+* concurrency - An integer for determining how many worker functions should be
+ run in parallel.
+
+__Queue objects__
+
+The queue object returned by this function has the following properties and
+methods:
+
+* length() - a function returning the number of items waiting to be processed.
+* concurrency - an integer for determining how many worker functions should be
+ run in parallel. This property can be changed after a queue is created to
+ alter the concurrency on-the-fly.
+* push(task, [callback]) - add a new task to the queue, the callback is called
+ once the worker has finished processing the task.
+ instead of a single task, an array of tasks can be submitted. the respective callback is used for every task in the list.
+* unshift(task, [callback]) - add a new task to the front of the queue.
+* saturated - a callback that is called when the queue length hits the concurrency and further tasks will be queued
+* empty - a callback that is called when the last item from the queue is given to a worker
+* drain - a callback that is called when the last item from the queue has returned from the worker
+
+__Example__
+
+```js
+// create a queue object with concurrency 2
+
+var q = async.queue(function (task, callback) {
+ console.log('hello ' + task.name);
+ callback();
+}, 2);
+
+
+// assign a callback
+q.drain = function() {
+ console.log('all items have been processed');
+}
+
+// add some items to the queue
+
+q.push({name: 'foo'}, function (err) {
+ console.log('finished processing foo');
+});
+q.push({name: 'bar'}, function (err) {
+ console.log('finished processing bar');
+});
+
+// add some items to the queue (batch-wise)
+
+q.push([{name: 'baz'},{name: 'bay'},{name: 'bax'}], function (err) {
+ console.log('finished processing bar');
+});
+
+// add some items to the front of the queue
+
+q.unshift({name: 'bar'}, function (err) {
+ console.log('finished processing bar');
+});
+```
+
+---------------------------------------
+
+
+### cargo(worker, [payload])
+
+Creates a cargo object with the specified payload. Tasks added to the
+cargo will be processed altogether (up to the payload limit). If the
+worker is in progress, the task is queued until it is available. Once
+the worker has completed some tasks, each callback of those tasks is called.
+
+__Arguments__
+
+* worker(tasks, callback) - An asynchronous function for processing an array of
+ queued tasks, which must call its callback(err) argument when finished, with
+ an optional error as an argument.
+* payload - An optional integer for determining how many tasks should be
+ processed per round; if omitted, the default is unlimited.
+
+__Cargo objects__
+
+The cargo object returned by this function has the following properties and
+methods:
+
+* length() - a function returning the number of items waiting to be processed.
+* payload - an integer for determining how many tasks should be
+ process per round. This property can be changed after a cargo is created to
+ alter the payload on-the-fly.
+* push(task, [callback]) - add a new task to the queue, the callback is called
+ once the worker has finished processing the task.
+ instead of a single task, an array of tasks can be submitted. the respective callback is used for every task in the list.
+* saturated - a callback that is called when the queue length hits the concurrency and further tasks will be queued
+* empty - a callback that is called when the last item from the queue is given to a worker
+* drain - a callback that is called when the last item from the queue has returned from the worker
+
+__Example__
+
+```js
+// create a cargo object with payload 2
+
+var cargo = async.cargo(function (tasks, callback) {
+ for(var i=0; i
+### auto(tasks, [callback])
+
+Determines the best order for running functions based on their requirements.
+Each function can optionally depend on other functions being completed first,
+and each function is run as soon as its requirements are satisfied. If any of
+the functions pass an error to their callback, that function will not complete
+(so any other functions depending on it will not run) and the main callback
+will be called immediately with the error. Functions also receive an object
+containing the results of functions which have completed so far.
+
+Note, all functions are called with a results object as a second argument,
+so it is unsafe to pass functions in the tasks object which cannot handle the
+extra argument. For example, this snippet of code:
+
+```js
+async.auto({
+ readData: async.apply(fs.readFile, 'data.txt', 'utf-8');
+}, callback);
+```
+
+will have the effect of calling readFile with the results object as the last
+argument, which will fail:
+
+```js
+fs.readFile('data.txt', 'utf-8', cb, {});
+```
+
+Instead, wrap the call to readFile in a function which does not forward the
+results object:
+
+```js
+async.auto({
+ readData: function(cb, results){
+ fs.readFile('data.txt', 'utf-8', cb);
+ }
+}, callback);
+```
+
+__Arguments__
+
+* tasks - An object literal containing named functions or an array of
+ requirements, with the function itself the last item in the array. The key
+ used for each function or array is used when specifying requirements. The
+ function receives two arguments: (1) a callback(err, result) which must be
+ called when finished, passing an error (which can be null) and the result of
+ the function's execution, and (2) a results object, containing the results of
+ the previously executed functions.
+* callback(err, results) - An optional callback which is called when all the
+ tasks have been completed. The callback will receive an error as an argument
+ if any tasks pass an error to their callback. Results will always be passed
+ but if an error occurred, no other tasks will be performed, and the results
+ object will only contain partial results.
+
+
+__Example__
+
+```js
+async.auto({
+ get_data: function(callback){
+ // async code to get some data
+ },
+ make_folder: function(callback){
+ // async code to create a directory to store a file in
+ // this is run at the same time as getting the data
+ },
+ write_file: ['get_data', 'make_folder', function(callback){
+ // once there is some data and the directory exists,
+ // write the data to a file in the directory
+ callback(null, filename);
+ }],
+ email_link: ['write_file', function(callback, results){
+ // once the file is written let's email a link to it...
+ // results.write_file contains the filename returned by write_file.
+ }]
+});
+```
+
+This is a fairly trivial example, but to do this using the basic parallel and
+series functions would look like this:
+
+```js
+async.parallel([
+ function(callback){
+ // async code to get some data
+ },
+ function(callback){
+ // async code to create a directory to store a file in
+ // this is run at the same time as getting the data
+ }
+],
+function(err, results){
+ async.series([
+ function(callback){
+ // once there is some data and the directory exists,
+ // write the data to a file in the directory
+ },
+ function(callback){
+ // once the file is written let's email a link to it...
+ }
+ ]);
+});
+```
+
+For a complicated series of async tasks using the auto function makes adding
+new tasks much easier and makes the code more readable.
+
+
+---------------------------------------
+
+
+### iterator(tasks)
+
+Creates an iterator function which calls the next function in the array,
+returning a continuation to call the next one after that. It's also possible to
+'peek' the next iterator by doing iterator.next().
+
+This function is used internally by the async module but can be useful when
+you want to manually control the flow of functions in series.
+
+__Arguments__
+
+* tasks - An array of functions to run.
+
+__Example__
+
+```js
+var iterator = async.iterator([
+ function(){ sys.p('one'); },
+ function(){ sys.p('two'); },
+ function(){ sys.p('three'); }
+]);
+
+node> var iterator2 = iterator();
+'one'
+node> var iterator3 = iterator2();
+'two'
+node> iterator3();
+'three'
+node> var nextfn = iterator2.next();
+node> nextfn();
+'three'
+```
+
+---------------------------------------
+
+
+### apply(function, arguments..)
+
+Creates a continuation function with some arguments already applied, a useful
+shorthand when combined with other control flow functions. Any arguments
+passed to the returned function are added to the arguments originally passed
+to apply.
+
+__Arguments__
+
+* function - The function you want to eventually apply all arguments to.
+* arguments... - Any number of arguments to automatically apply when the
+ continuation is called.
+
+__Example__
+
+```js
+// using apply
+
+async.parallel([
+ async.apply(fs.writeFile, 'testfile1', 'test1'),
+ async.apply(fs.writeFile, 'testfile2', 'test2'),
+]);
+
+
+// the same process without using apply
+
+async.parallel([
+ function(callback){
+ fs.writeFile('testfile1', 'test1', callback);
+ },
+ function(callback){
+ fs.writeFile('testfile2', 'test2', callback);
+ }
+]);
+```
+
+It's possible to pass any number of additional arguments when calling the
+continuation:
+
+```js
+node> var fn = async.apply(sys.puts, 'one');
+node> fn('two', 'three');
+one
+two
+three
+```
+
+---------------------------------------
+
+
+### nextTick(callback)
+
+Calls the callback on a later loop around the event loop. In node.js this just
+calls process.nextTick, in the browser it falls back to setImmediate(callback)
+if available, otherwise setTimeout(callback, 0), which means other higher priority
+events may precede the execution of the callback.
+
+This is used internally for browser-compatibility purposes.
+
+__Arguments__
+
+* callback - The function to call on a later loop around the event loop.
+
+__Example__
+
+```js
+var call_order = [];
+async.nextTick(function(){
+ call_order.push('two');
+ // call_order now equals ['one','two']
+});
+call_order.push('one')
+```
+
+
+### times(n, callback)
+
+Calls the callback n times and accumulates results in the same manner
+you would use with async.map.
+
+__Arguments__
+
+* n - The number of times to run the function.
+* callback - The function to call n times.
+
+__Example__
+
+```js
+// Pretend this is some complicated async factory
+var createUser = function(id, callback) {
+ callback(null, {
+ id: 'user' + id
+ })
+}
+// generate 5 users
+async.times(5, function(n, next){
+ createUser(n, function(err, user) {
+ next(err, user)
+ })
+}, function(err, users) {
+ // we should now have 5 users
+});
+```
+
+
+### timesSeries(n, callback)
+
+The same as times only the iterator is applied to each item in the array in
+series. The next iterator is only called once the current one has completed
+processing. The results array will be in the same order as the original.
+
+
+## Utils
+
+
+### memoize(fn, [hasher])
+
+Caches the results of an async function. When creating a hash to store function
+results against, the callback is omitted from the hash and an optional hash
+function can be used.
+
+The cache of results is exposed as the `memo` property of the function returned
+by `memoize`.
+
+__Arguments__
+
+* fn - the function you to proxy and cache results from.
+* hasher - an optional function for generating a custom hash for storing
+ results, it has all the arguments applied to it apart from the callback, and
+ must be synchronous.
+
+__Example__
+
+```js
+var slow_fn = function (name, callback) {
+ // do something
+ callback(null, result);
+};
+var fn = async.memoize(slow_fn);
+
+// fn can now be used as if it were slow_fn
+fn('some name', function () {
+ // callback
+});
+```
+
+
+### unmemoize(fn)
+
+Undoes a memoized function, reverting it to the original, unmemoized
+form. Comes handy in tests.
+
+__Arguments__
+
+* fn - the memoized function
+
+
+### log(function, arguments)
+
+Logs the result of an async function to the console. Only works in node.js or
+in browsers that support console.log and console.error (such as FF and Chrome).
+If multiple arguments are returned from the async function, console.log is
+called on each argument in order.
+
+__Arguments__
+
+* function - The function you want to eventually apply all arguments to.
+* arguments... - Any number of arguments to apply to the function.
+
+__Example__
+
+```js
+var hello = function(name, callback){
+ setTimeout(function(){
+ callback(null, 'hello ' + name);
+ }, 1000);
+};
+```
+```js
+node> async.log(hello, 'world');
+'hello world'
+```
+
+---------------------------------------
+
+
+### dir(function, arguments)
+
+Logs the result of an async function to the console using console.dir to
+display the properties of the resulting object. Only works in node.js or
+in browsers that support console.dir and console.error (such as FF and Chrome).
+If multiple arguments are returned from the async function, console.dir is
+called on each argument in order.
+
+__Arguments__
+
+* function - The function you want to eventually apply all arguments to.
+* arguments... - Any number of arguments to apply to the function.
+
+__Example__
+
+```js
+var hello = function(name, callback){
+ setTimeout(function(){
+ callback(null, {hello: name});
+ }, 1000);
+};
+```
+```js
+node> async.dir(hello, 'world');
+{hello: 'world'}
+```
+
+---------------------------------------
+
+
+### noConflict()
+
+Changes the value of async back to its original value, returning a reference to the
+async object.
diff --git a/node_modules/jsftp/node_modules/async/component.json b/node_modules/jsftp/node_modules/async/component.json
new file mode 100644
index 0000000..bbb0115
--- /dev/null
+++ b/node_modules/jsftp/node_modules/async/component.json
@@ -0,0 +1,11 @@
+{
+ "name": "async",
+ "repo": "caolan/async",
+ "description": "Higher-order functions and common patterns for asynchronous code",
+ "version": "0.1.23",
+ "keywords": [],
+ "dependencies": {},
+ "development": {},
+ "main": "lib/async.js",
+ "scripts": [ "lib/async.js" ]
+}
diff --git a/node_modules/jsftp/node_modules/async/lib/async.js b/node_modules/jsftp/node_modules/async/lib/async.js
new file mode 100755
index 0000000..cb6320d
--- /dev/null
+++ b/node_modules/jsftp/node_modules/async/lib/async.js
@@ -0,0 +1,955 @@
+/*global setImmediate: false, setTimeout: false, console: false */
+(function () {
+
+ var async = {};
+
+ // global on the server, window in the browser
+ var root, previous_async;
+
+ root = this;
+ if (root != null) {
+ previous_async = root.async;
+ }
+
+ async.noConflict = function () {
+ root.async = previous_async;
+ return async;
+ };
+
+ function only_once(fn) {
+ var called = false;
+ return function() {
+ if (called) throw new Error("Callback was already called.");
+ called = true;
+ fn.apply(root, arguments);
+ }
+ }
+
+ //// cross-browser compatiblity functions ////
+
+ var _each = function (arr, iterator) {
+ if (arr.forEach) {
+ return arr.forEach(iterator);
+ }
+ for (var i = 0; i < arr.length; i += 1) {
+ iterator(arr[i], i, arr);
+ }
+ };
+
+ var _map = function (arr, iterator) {
+ if (arr.map) {
+ return arr.map(iterator);
+ }
+ var results = [];
+ _each(arr, function (x, i, a) {
+ results.push(iterator(x, i, a));
+ });
+ return results;
+ };
+
+ var _reduce = function (arr, iterator, memo) {
+ if (arr.reduce) {
+ return arr.reduce(iterator, memo);
+ }
+ _each(arr, function (x, i, a) {
+ memo = iterator(memo, x, i, a);
+ });
+ return memo;
+ };
+
+ var _keys = function (obj) {
+ if (Object.keys) {
+ return Object.keys(obj);
+ }
+ var keys = [];
+ for (var k in obj) {
+ if (obj.hasOwnProperty(k)) {
+ keys.push(k);
+ }
+ }
+ return keys;
+ };
+
+ //// exported async module functions ////
+
+ //// nextTick implementation with browser-compatible fallback ////
+ if (typeof process === 'undefined' || !(process.nextTick)) {
+ if (typeof setImmediate === 'function') {
+ async.nextTick = function (fn) {
+ // not a direct alias for IE10 compatibility
+ setImmediate(fn);
+ };
+ async.setImmediate = async.nextTick;
+ }
+ else {
+ async.nextTick = function (fn) {
+ setTimeout(fn, 0);
+ };
+ async.setImmediate = async.nextTick;
+ }
+ }
+ else {
+ async.nextTick = process.nextTick;
+ if (typeof setImmediate !== 'undefined') {
+ async.setImmediate = setImmediate;
+ }
+ else {
+ async.setImmediate = async.nextTick;
+ }
+ }
+
+ async.each = function (arr, iterator, callback) {
+ callback = callback || function () {};
+ if (!arr.length) {
+ return callback();
+ }
+ var completed = 0;
+ _each(arr, function (x) {
+ iterator(x, only_once(function (err) {
+ if (err) {
+ callback(err);
+ callback = function () {};
+ }
+ else {
+ completed += 1;
+ if (completed >= arr.length) {
+ callback(null);
+ }
+ }
+ }));
+ });
+ };
+ async.forEach = async.each;
+
+ async.eachSeries = function (arr, iterator, callback) {
+ callback = callback || function () {};
+ if (!arr.length) {
+ return callback();
+ }
+ var completed = 0;
+ var iterate = function () {
+ iterator(arr[completed], function (err) {
+ if (err) {
+ callback(err);
+ callback = function () {};
+ }
+ else {
+ completed += 1;
+ if (completed >= arr.length) {
+ callback(null);
+ }
+ else {
+ iterate();
+ }
+ }
+ });
+ };
+ iterate();
+ };
+ async.forEachSeries = async.eachSeries;
+
+ async.eachLimit = function (arr, limit, iterator, callback) {
+ var fn = _eachLimit(limit);
+ fn.apply(null, [arr, iterator, callback]);
+ };
+ async.forEachLimit = async.eachLimit;
+
+ var _eachLimit = function (limit) {
+
+ return function (arr, iterator, callback) {
+ callback = callback || function () {};
+ if (!arr.length || limit <= 0) {
+ return callback();
+ }
+ var completed = 0;
+ var started = 0;
+ var running = 0;
+
+ (function replenish () {
+ if (completed >= arr.length) {
+ return callback();
+ }
+
+ while (running < limit && started < arr.length) {
+ started += 1;
+ running += 1;
+ iterator(arr[started - 1], function (err) {
+ if (err) {
+ callback(err);
+ callback = function () {};
+ }
+ else {
+ completed += 1;
+ running -= 1;
+ if (completed >= arr.length) {
+ callback();
+ }
+ else {
+ replenish();
+ }
+ }
+ });
+ }
+ })();
+ };
+ };
+
+
+ var doParallel = function (fn) {
+ return function () {
+ var args = Array.prototype.slice.call(arguments);
+ return fn.apply(null, [async.each].concat(args));
+ };
+ };
+ var doParallelLimit = function(limit, fn) {
+ return function () {
+ var args = Array.prototype.slice.call(arguments);
+ return fn.apply(null, [_eachLimit(limit)].concat(args));
+ };
+ };
+ var doSeries = function (fn) {
+ return function () {
+ var args = Array.prototype.slice.call(arguments);
+ return fn.apply(null, [async.eachSeries].concat(args));
+ };
+ };
+
+
+ var _asyncMap = function (eachfn, arr, iterator, callback) {
+ var results = [];
+ arr = _map(arr, function (x, i) {
+ return {index: i, value: x};
+ });
+ eachfn(arr, function (x, callback) {
+ iterator(x.value, function (err, v) {
+ results[x.index] = v;
+ callback(err);
+ });
+ }, function (err) {
+ callback(err, results);
+ });
+ };
+ async.map = doParallel(_asyncMap);
+ async.mapSeries = doSeries(_asyncMap);
+ async.mapLimit = function (arr, limit, iterator, callback) {
+ return _mapLimit(limit)(arr, iterator, callback);
+ };
+
+ var _mapLimit = function(limit) {
+ return doParallelLimit(limit, _asyncMap);
+ };
+
+ // reduce only has a series version, as doing reduce in parallel won't
+ // work in many situations.
+ async.reduce = function (arr, memo, iterator, callback) {
+ async.eachSeries(arr, function (x, callback) {
+ iterator(memo, x, function (err, v) {
+ memo = v;
+ callback(err);
+ });
+ }, function (err) {
+ callback(err, memo);
+ });
+ };
+ // inject alias
+ async.inject = async.reduce;
+ // foldl alias
+ async.foldl = async.reduce;
+
+ async.reduceRight = function (arr, memo, iterator, callback) {
+ var reversed = _map(arr, function (x) {
+ return x;
+ }).reverse();
+ async.reduce(reversed, memo, iterator, callback);
+ };
+ // foldr alias
+ async.foldr = async.reduceRight;
+
+ var _filter = function (eachfn, arr, iterator, callback) {
+ var results = [];
+ arr = _map(arr, function (x, i) {
+ return {index: i, value: x};
+ });
+ eachfn(arr, function (x, callback) {
+ iterator(x.value, function (v) {
+ if (v) {
+ results.push(x);
+ }
+ callback();
+ });
+ }, function (err) {
+ callback(_map(results.sort(function (a, b) {
+ return a.index - b.index;
+ }), function (x) {
+ return x.value;
+ }));
+ });
+ };
+ async.filter = doParallel(_filter);
+ async.filterSeries = doSeries(_filter);
+ // select alias
+ async.select = async.filter;
+ async.selectSeries = async.filterSeries;
+
+ var _reject = function (eachfn, arr, iterator, callback) {
+ var results = [];
+ arr = _map(arr, function (x, i) {
+ return {index: i, value: x};
+ });
+ eachfn(arr, function (x, callback) {
+ iterator(x.value, function (v) {
+ if (!v) {
+ results.push(x);
+ }
+ callback();
+ });
+ }, function (err) {
+ callback(_map(results.sort(function (a, b) {
+ return a.index - b.index;
+ }), function (x) {
+ return x.value;
+ }));
+ });
+ };
+ async.reject = doParallel(_reject);
+ async.rejectSeries = doSeries(_reject);
+
+ var _detect = function (eachfn, arr, iterator, main_callback) {
+ eachfn(arr, function (x, callback) {
+ iterator(x, function (result) {
+ if (result) {
+ main_callback(x);
+ main_callback = function () {};
+ }
+ else {
+ callback();
+ }
+ });
+ }, function (err) {
+ main_callback();
+ });
+ };
+ async.detect = doParallel(_detect);
+ async.detectSeries = doSeries(_detect);
+
+ async.some = function (arr, iterator, main_callback) {
+ async.each(arr, function (x, callback) {
+ iterator(x, function (v) {
+ if (v) {
+ main_callback(true);
+ main_callback = function () {};
+ }
+ callback();
+ });
+ }, function (err) {
+ main_callback(false);
+ });
+ };
+ // any alias
+ async.any = async.some;
+
+ async.every = function (arr, iterator, main_callback) {
+ async.each(arr, function (x, callback) {
+ iterator(x, function (v) {
+ if (!v) {
+ main_callback(false);
+ main_callback = function () {};
+ }
+ callback();
+ });
+ }, function (err) {
+ main_callback(true);
+ });
+ };
+ // all alias
+ async.all = async.every;
+
+ async.sortBy = function (arr, iterator, callback) {
+ async.map(arr, function (x, callback) {
+ iterator(x, function (err, criteria) {
+ if (err) {
+ callback(err);
+ }
+ else {
+ callback(null, {value: x, criteria: criteria});
+ }
+ });
+ }, function (err, results) {
+ if (err) {
+ return callback(err);
+ }
+ else {
+ var fn = function (left, right) {
+ var a = left.criteria, b = right.criteria;
+ return a < b ? -1 : a > b ? 1 : 0;
+ };
+ callback(null, _map(results.sort(fn), function (x) {
+ return x.value;
+ }));
+ }
+ });
+ };
+
+ async.auto = function (tasks, callback) {
+ callback = callback || function () {};
+ var keys = _keys(tasks);
+ if (!keys.length) {
+ return callback(null);
+ }
+
+ var results = {};
+
+ var listeners = [];
+ var addListener = function (fn) {
+ listeners.unshift(fn);
+ };
+ var removeListener = function (fn) {
+ for (var i = 0; i < listeners.length; i += 1) {
+ if (listeners[i] === fn) {
+ listeners.splice(i, 1);
+ return;
+ }
+ }
+ };
+ var taskComplete = function () {
+ _each(listeners.slice(0), function (fn) {
+ fn();
+ });
+ };
+
+ addListener(function () {
+ if (_keys(results).length === keys.length) {
+ callback(null, results);
+ callback = function () {};
+ }
+ });
+
+ _each(keys, function (k) {
+ var task = (tasks[k] instanceof Function) ? [tasks[k]]: tasks[k];
+ var taskCallback = function (err) {
+ var args = Array.prototype.slice.call(arguments, 1);
+ if (args.length <= 1) {
+ args = args[0];
+ }
+ if (err) {
+ var safeResults = {};
+ _each(_keys(results), function(rkey) {
+ safeResults[rkey] = results[rkey];
+ });
+ safeResults[k] = args;
+ callback(err, safeResults);
+ // stop subsequent errors hitting callback multiple times
+ callback = function () {};
+ }
+ else {
+ results[k] = args;
+ async.setImmediate(taskComplete);
+ }
+ };
+ var requires = task.slice(0, Math.abs(task.length - 1)) || [];
+ var ready = function () {
+ return _reduce(requires, function (a, x) {
+ return (a && results.hasOwnProperty(x));
+ }, true) && !results.hasOwnProperty(k);
+ };
+ if (ready()) {
+ task[task.length - 1](taskCallback, results);
+ }
+ else {
+ var listener = function () {
+ if (ready()) {
+ removeListener(listener);
+ task[task.length - 1](taskCallback, results);
+ }
+ };
+ addListener(listener);
+ }
+ });
+ };
+
+ async.waterfall = function (tasks, callback) {
+ callback = callback || function () {};
+ if (tasks.constructor !== Array) {
+ var err = new Error('First argument to waterfall must be an array of functions');
+ return callback(err);
+ }
+ if (!tasks.length) {
+ return callback();
+ }
+ var wrapIterator = function (iterator) {
+ return function (err) {
+ if (err) {
+ callback.apply(null, arguments);
+ callback = function () {};
+ }
+ else {
+ var args = Array.prototype.slice.call(arguments, 1);
+ var next = iterator.next();
+ if (next) {
+ args.push(wrapIterator(next));
+ }
+ else {
+ args.push(callback);
+ }
+ async.setImmediate(function () {
+ iterator.apply(null, args);
+ });
+ }
+ };
+ };
+ wrapIterator(async.iterator(tasks))();
+ };
+
+ var _parallel = function(eachfn, tasks, callback) {
+ callback = callback || function () {};
+ if (tasks.constructor === Array) {
+ eachfn.map(tasks, function (fn, callback) {
+ if (fn) {
+ fn(function (err) {
+ var args = Array.prototype.slice.call(arguments, 1);
+ if (args.length <= 1) {
+ args = args[0];
+ }
+ callback.call(null, err, args);
+ });
+ }
+ }, callback);
+ }
+ else {
+ var results = {};
+ eachfn.each(_keys(tasks), function (k, callback) {
+ tasks[k](function (err) {
+ var args = Array.prototype.slice.call(arguments, 1);
+ if (args.length <= 1) {
+ args = args[0];
+ }
+ results[k] = args;
+ callback(err);
+ });
+ }, function (err) {
+ callback(err, results);
+ });
+ }
+ };
+
+ async.parallel = function (tasks, callback) {
+ _parallel({ map: async.map, each: async.each }, tasks, callback);
+ };
+
+ async.parallelLimit = function(tasks, limit, callback) {
+ _parallel({ map: _mapLimit(limit), each: _eachLimit(limit) }, tasks, callback);
+ };
+
+ async.series = function (tasks, callback) {
+ callback = callback || function () {};
+ if (tasks.constructor === Array) {
+ async.mapSeries(tasks, function (fn, callback) {
+ if (fn) {
+ fn(function (err) {
+ var args = Array.prototype.slice.call(arguments, 1);
+ if (args.length <= 1) {
+ args = args[0];
+ }
+ callback.call(null, err, args);
+ });
+ }
+ }, callback);
+ }
+ else {
+ var results = {};
+ async.eachSeries(_keys(tasks), function (k, callback) {
+ tasks[k](function (err) {
+ var args = Array.prototype.slice.call(arguments, 1);
+ if (args.length <= 1) {
+ args = args[0];
+ }
+ results[k] = args;
+ callback(err);
+ });
+ }, function (err) {
+ callback(err, results);
+ });
+ }
+ };
+
+ async.iterator = function (tasks) {
+ var makeCallback = function (index) {
+ var fn = function () {
+ if (tasks.length) {
+ tasks[index].apply(null, arguments);
+ }
+ return fn.next();
+ };
+ fn.next = function () {
+ return (index < tasks.length - 1) ? makeCallback(index + 1): null;
+ };
+ return fn;
+ };
+ return makeCallback(0);
+ };
+
+ async.apply = function (fn) {
+ var args = Array.prototype.slice.call(arguments, 1);
+ return function () {
+ return fn.apply(
+ null, args.concat(Array.prototype.slice.call(arguments))
+ );
+ };
+ };
+
+ var _concat = function (eachfn, arr, fn, callback) {
+ var r = [];
+ eachfn(arr, function (x, cb) {
+ fn(x, function (err, y) {
+ r = r.concat(y || []);
+ cb(err);
+ });
+ }, function (err) {
+ callback(err, r);
+ });
+ };
+ async.concat = doParallel(_concat);
+ async.concatSeries = doSeries(_concat);
+
+ async.whilst = function (test, iterator, callback) {
+ if (test()) {
+ iterator(function (err) {
+ if (err) {
+ return callback(err);
+ }
+ async.whilst(test, iterator, callback);
+ });
+ }
+ else {
+ callback();
+ }
+ };
+
+ async.doWhilst = function (iterator, test, callback) {
+ iterator(function (err) {
+ if (err) {
+ return callback(err);
+ }
+ if (test()) {
+ async.doWhilst(iterator, test, callback);
+ }
+ else {
+ callback();
+ }
+ });
+ };
+
+ async.until = function (test, iterator, callback) {
+ if (!test()) {
+ iterator(function (err) {
+ if (err) {
+ return callback(err);
+ }
+ async.until(test, iterator, callback);
+ });
+ }
+ else {
+ callback();
+ }
+ };
+
+ async.doUntil = function (iterator, test, callback) {
+ iterator(function (err) {
+ if (err) {
+ return callback(err);
+ }
+ if (!test()) {
+ async.doUntil(iterator, test, callback);
+ }
+ else {
+ callback();
+ }
+ });
+ };
+
+ async.queue = function (worker, concurrency) {
+ if (concurrency === undefined) {
+ concurrency = 1;
+ }
+ function _insert(q, data, pos, callback) {
+ if(data.constructor !== Array) {
+ data = [data];
+ }
+ _each(data, function(task) {
+ var item = {
+ data: task,
+ callback: typeof callback === 'function' ? callback : null
+ };
+
+ if (pos) {
+ q.tasks.unshift(item);
+ } else {
+ q.tasks.push(item);
+ }
+
+ if (q.saturated && q.tasks.length === concurrency) {
+ q.saturated();
+ }
+ async.setImmediate(q.process);
+ });
+ }
+
+ var workers = 0;
+ var q = {
+ tasks: [],
+ concurrency: concurrency,
+ saturated: null,
+ empty: null,
+ drain: null,
+ push: function (data, callback) {
+ _insert(q, data, false, callback);
+ },
+ unshift: function (data, callback) {
+ _insert(q, data, true, callback);
+ },
+ process: function () {
+ if (workers < q.concurrency && q.tasks.length) {
+ var task = q.tasks.shift();
+ if (q.empty && q.tasks.length === 0) {
+ q.empty();
+ }
+ workers += 1;
+ var next = function () {
+ workers -= 1;
+ if (task.callback) {
+ task.callback.apply(task, arguments);
+ }
+ if (q.drain && q.tasks.length + workers === 0) {
+ q.drain();
+ }
+ q.process();
+ };
+ var cb = only_once(next);
+ worker(task.data, cb);
+ }
+ },
+ length: function () {
+ return q.tasks.length;
+ },
+ running: function () {
+ return workers;
+ }
+ };
+ return q;
+ };
+
+ async.cargo = function (worker, payload) {
+ var working = false,
+ tasks = [];
+
+ var cargo = {
+ tasks: tasks,
+ payload: payload,
+ saturated: null,
+ empty: null,
+ drain: null,
+ push: function (data, callback) {
+ if(data.constructor !== Array) {
+ data = [data];
+ }
+ _each(data, function(task) {
+ tasks.push({
+ data: task,
+ callback: typeof callback === 'function' ? callback : null
+ });
+ if (cargo.saturated && tasks.length === payload) {
+ cargo.saturated();
+ }
+ });
+ async.setImmediate(cargo.process);
+ },
+ process: function process() {
+ if (working) return;
+ if (tasks.length === 0) {
+ if(cargo.drain) cargo.drain();
+ return;
+ }
+
+ var ts = typeof payload === 'number'
+ ? tasks.splice(0, payload)
+ : tasks.splice(0);
+
+ var ds = _map(ts, function (task) {
+ return task.data;
+ });
+
+ if(cargo.empty) cargo.empty();
+ working = true;
+ worker(ds, function () {
+ working = false;
+
+ var args = arguments;
+ _each(ts, function (data) {
+ if (data.callback) {
+ data.callback.apply(null, args);
+ }
+ });
+
+ process();
+ });
+ },
+ length: function () {
+ return tasks.length;
+ },
+ running: function () {
+ return working;
+ }
+ };
+ return cargo;
+ };
+
+ var _console_fn = function (name) {
+ return function (fn) {
+ var args = Array.prototype.slice.call(arguments, 1);
+ fn.apply(null, args.concat([function (err) {
+ var args = Array.prototype.slice.call(arguments, 1);
+ if (typeof console !== 'undefined') {
+ if (err) {
+ if (console.error) {
+ console.error(err);
+ }
+ }
+ else if (console[name]) {
+ _each(args, function (x) {
+ console[name](x);
+ });
+ }
+ }
+ }]));
+ };
+ };
+ async.log = _console_fn('log');
+ async.dir = _console_fn('dir');
+ /*async.info = _console_fn('info');
+ async.warn = _console_fn('warn');
+ async.error = _console_fn('error');*/
+
+ async.memoize = function (fn, hasher) {
+ var memo = {};
+ var queues = {};
+ hasher = hasher || function (x) {
+ return x;
+ };
+ var memoized = function () {
+ var args = Array.prototype.slice.call(arguments);
+ var callback = args.pop();
+ var key = hasher.apply(null, args);
+ if (key in memo) {
+ callback.apply(null, memo[key]);
+ }
+ else if (key in queues) {
+ queues[key].push(callback);
+ }
+ else {
+ queues[key] = [callback];
+ fn.apply(null, args.concat([function () {
+ memo[key] = arguments;
+ var q = queues[key];
+ delete queues[key];
+ for (var i = 0, l = q.length; i < l; i++) {
+ q[i].apply(null, arguments);
+ }
+ }]));
+ }
+ };
+ memoized.memo = memo;
+ memoized.unmemoized = fn;
+ return memoized;
+ };
+
+ async.unmemoize = function (fn) {
+ return function () {
+ return (fn.unmemoized || fn).apply(null, arguments);
+ };
+ };
+
+ async.times = function (count, iterator, callback) {
+ var counter = [];
+ for (var i = 0; i < count; i++) {
+ counter.push(i);
+ }
+ return async.map(counter, iterator, callback);
+ };
+
+ async.timesSeries = function (count, iterator, callback) {
+ var counter = [];
+ for (var i = 0; i < count; i++) {
+ counter.push(i);
+ }
+ return async.mapSeries(counter, iterator, callback);
+ };
+
+ async.compose = function (/* functions... */) {
+ var fns = Array.prototype.reverse.call(arguments);
+ return function () {
+ var that = this;
+ var args = Array.prototype.slice.call(arguments);
+ var callback = args.pop();
+ async.reduce(fns, args, function (newargs, fn, cb) {
+ fn.apply(that, newargs.concat([function () {
+ var err = arguments[0];
+ var nextargs = Array.prototype.slice.call(arguments, 1);
+ cb(err, nextargs);
+ }]))
+ },
+ function (err, results) {
+ callback.apply(that, [err].concat(results));
+ });
+ };
+ };
+
+ var _applyEach = function (eachfn, fns /*args...*/) {
+ var go = function () {
+ var that = this;
+ var args = Array.prototype.slice.call(arguments);
+ var callback = args.pop();
+ return eachfn(fns, function (fn, cb) {
+ fn.apply(that, args.concat([cb]));
+ },
+ callback);
+ };
+ if (arguments.length > 2) {
+ var args = Array.prototype.slice.call(arguments, 2);
+ return go.apply(this, args);
+ }
+ else {
+ return go;
+ }
+ };
+ async.applyEach = doParallel(_applyEach);
+ async.applyEachSeries = doSeries(_applyEach);
+
+ async.forever = function (fn, callback) {
+ function next(err) {
+ if (err) {
+ if (callback) {
+ return callback(err);
+ }
+ throw err;
+ }
+ fn(next);
+ }
+ next();
+ };
+
+ // AMD / RequireJS
+ if (typeof define !== 'undefined' && define.amd) {
+ define([], function () {
+ return async;
+ });
+ }
+ // Node.js
+ else if (typeof module !== 'undefined' && module.exports) {
+ module.exports = async;
+ }
+ // included directly via \n\n```\n\n## Documentation\n\n### Collections\n\n* [each](#each)\n* [map](#map)\n* [filter](#filter)\n* [reject](#reject)\n* [reduce](#reduce)\n* [detect](#detect)\n* [sortBy](#sortBy)\n* [some](#some)\n* [every](#every)\n* [concat](#concat)\n\n### Control Flow\n\n* [series](#series)\n* [parallel](#parallel)\n* [whilst](#whilst)\n* [doWhilst](#doWhilst)\n* [until](#until)\n* [doUntil](#doUntil)\n* [forever](#forever)\n* [waterfall](#waterfall)\n* [compose](#compose)\n* [applyEach](#applyEach)\n* [queue](#queue)\n* [cargo](#cargo)\n* [auto](#auto)\n* [iterator](#iterator)\n* [apply](#apply)\n* [nextTick](#nextTick)\n* [times](#times)\n* [timesSeries](#timesSeries)\n\n### Utils\n\n* [memoize](#memoize)\n* [unmemoize](#unmemoize)\n* [log](#log)\n* [dir](#dir)\n* [noConflict](#noConflict)\n\n\n## Collections\n\n\n\n### each(arr, iterator, callback)\n\nApplies an iterator function to each item in an array, in parallel.\nThe iterator is called with an item from the list and a callback for when it\nhas finished. If the iterator passes an error to this callback, the main\ncallback for the each function is immediately called with the error.\n\nNote, that since this function applies the iterator to each item in parallel\nthere is no guarantee that the iterator functions will complete in order.\n\n__Arguments__\n\n* arr - An array to iterate over.\n* iterator(item, callback) - A function to apply to each item in the array.\n The iterator is passed a callback(err) which must be called once it has \n completed. If no error has occured, the callback should be run without \n arguments or with an explicit null argument.\n* callback(err) - A callback which is called after all the iterator functions\n have finished, or an error has occurred.\n\n__Example__\n\n```js\n// assuming openFiles is an array of file names and saveFile is a function\n// to save the modified contents of that file:\n\nasync.each(openFiles, saveFile, function(err){\n // if any of the saves produced an error, err would equal that error\n});\n```\n\n---------------------------------------\n\n\n\n### eachSeries(arr, iterator, callback)\n\nThe same as each only the iterator is applied to each item in the array in\nseries. The next iterator is only called once the current one has completed\nprocessing. This means the iterator functions will complete in order.\n\n\n---------------------------------------\n\n\n\n### eachLimit(arr, limit, iterator, callback)\n\nThe same as each only no more than \"limit\" iterators will be simultaneously \nrunning at any time.\n\nNote that the items are not processed in batches, so there is no guarantee that\n the first \"limit\" iterator functions will complete before any others are \nstarted.\n\n__Arguments__\n\n* arr - An array to iterate over.\n* limit - The maximum number of iterators to run at any time.\n* iterator(item, callback) - A function to apply to each item in the array.\n The iterator is passed a callback(err) which must be called once it has \n completed. If no error has occured, the callback should be run without \n arguments or with an explicit null argument.\n* callback(err) - A callback which is called after all the iterator functions\n have finished, or an error has occurred.\n\n__Example__\n\n```js\n// Assume documents is an array of JSON objects and requestApi is a\n// function that interacts with a rate-limited REST api.\n\nasync.eachLimit(documents, 20, requestApi, function(err){\n // if any of the saves produced an error, err would equal that error\n});\n```\n\n---------------------------------------\n\n\n### map(arr, iterator, callback)\n\nProduces a new array of values by mapping each value in the given array through\nthe iterator function. The iterator is called with an item from the array and a\ncallback for when it has finished processing. The callback takes 2 arguments, \nan error and the transformed item from the array. If the iterator passes an\nerror to this callback, the main callback for the map function is immediately\ncalled with the error.\n\nNote, that since this function applies the iterator to each item in parallel\nthere is no guarantee that the iterator functions will complete in order, however\nthe results array will be in the same order as the original array.\n\n__Arguments__\n\n* arr - An array to iterate over.\n* iterator(item, callback) - A function to apply to each item in the array.\n The iterator is passed a callback(err, transformed) which must be called once \n it has completed with an error (which can be null) and a transformed item.\n* callback(err, results) - A callback which is called after all the iterator\n functions have finished, or an error has occurred. Results is an array of the\n transformed items from the original array.\n\n__Example__\n\n```js\nasync.map(['file1','file2','file3'], fs.stat, function(err, results){\n // results is now an array of stats for each file\n});\n```\n\n---------------------------------------\n\n\n### mapSeries(arr, iterator, callback)\n\nThe same as map only the iterator is applied to each item in the array in\nseries. The next iterator is only called once the current one has completed\nprocessing. The results array will be in the same order as the original.\n\n\n---------------------------------------\n\n\n### mapLimit(arr, limit, iterator, callback)\n\nThe same as map only no more than \"limit\" iterators will be simultaneously \nrunning at any time.\n\nNote that the items are not processed in batches, so there is no guarantee that\n the first \"limit\" iterator functions will complete before any others are \nstarted.\n\n__Arguments__\n\n* arr - An array to iterate over.\n* limit - The maximum number of iterators to run at any time.\n* iterator(item, callback) - A function to apply to each item in the array.\n The iterator is passed a callback(err, transformed) which must be called once \n it has completed with an error (which can be null) and a transformed item.\n* callback(err, results) - A callback which is called after all the iterator\n functions have finished, or an error has occurred. Results is an array of the\n transformed items from the original array.\n\n__Example__\n\n```js\nasync.map(['file1','file2','file3'], 1, fs.stat, function(err, results){\n // results is now an array of stats for each file\n});\n```\n\n---------------------------------------\n\n\n### filter(arr, iterator, callback)\n\n__Alias:__ select\n\nReturns a new array of all the values which pass an async truth test.\n_The callback for each iterator call only accepts a single argument of true or\nfalse, it does not accept an error argument first!_ This is in-line with the\nway node libraries work with truth tests like fs.exists. This operation is\nperformed in parallel, but the results array will be in the same order as the\noriginal.\n\n__Arguments__\n\n* arr - An array to iterate over.\n* iterator(item, callback) - A truth test to apply to each item in the array.\n The iterator is passed a callback(truthValue) which must be called with a \n boolean argument once it has completed.\n* callback(results) - A callback which is called after all the iterator\n functions have finished.\n\n__Example__\n\n```js\nasync.filter(['file1','file2','file3'], fs.exists, function(results){\n // results now equals an array of the existing files\n});\n```\n\n---------------------------------------\n\n\n### filterSeries(arr, iterator, callback)\n\n__alias:__ selectSeries\n\nThe same as filter only the iterator is applied to each item in the array in\nseries. The next iterator is only called once the current one has completed\nprocessing. The results array will be in the same order as the original.\n\n---------------------------------------\n\n\n### reject(arr, iterator, callback)\n\nThe opposite of filter. Removes values that pass an async truth test.\n\n---------------------------------------\n\n\n### rejectSeries(arr, iterator, callback)\n\nThe same as reject, only the iterator is applied to each item in the array\nin series.\n\n\n---------------------------------------\n\n\n### reduce(arr, memo, iterator, callback)\n\n__aliases:__ inject, foldl\n\nReduces a list of values into a single value using an async iterator to return\neach successive step. Memo is the initial state of the reduction. This\nfunction only operates in series. For performance reasons, it may make sense to\nsplit a call to this function into a parallel map, then use the normal\nArray.prototype.reduce on the results. This function is for situations where\neach step in the reduction needs to be async, if you can get the data before\nreducing it then it's probably a good idea to do so.\n\n__Arguments__\n\n* arr - An array to iterate over.\n* memo - The initial state of the reduction.\n* iterator(memo, item, callback) - A function applied to each item in the\n array to produce the next step in the reduction. The iterator is passed a\n callback(err, reduction) which accepts an optional error as its first \n argument, and the state of the reduction as the second. If an error is \n passed to the callback, the reduction is stopped and the main callback is \n immediately called with the error.\n* callback(err, result) - A callback which is called after all the iterator\n functions have finished. Result is the reduced value.\n\n__Example__\n\n```js\nasync.reduce([1,2,3], 0, function(memo, item, callback){\n // pointless async:\n process.nextTick(function(){\n callback(null, memo + item)\n });\n}, function(err, result){\n // result is now equal to the last value of memo, which is 6\n});\n```\n\n---------------------------------------\n\n\n### reduceRight(arr, memo, iterator, callback)\n\n__Alias:__ foldr\n\nSame as reduce, only operates on the items in the array in reverse order.\n\n\n---------------------------------------\n\n\n### detect(arr, iterator, callback)\n\nReturns the first value in a list that passes an async truth test. The\niterator is applied in parallel, meaning the first iterator to return true will\nfire the detect callback with that result. That means the result might not be\nthe first item in the original array (in terms of order) that passes the test.\n\nIf order within the original array is important then look at detectSeries.\n\n__Arguments__\n\n* arr - An array to iterate over.\n* iterator(item, callback) - A truth test to apply to each item in the array.\n The iterator is passed a callback(truthValue) which must be called with a \n boolean argument once it has completed.\n* callback(result) - A callback which is called as soon as any iterator returns\n true, or after all the iterator functions have finished. Result will be\n the first item in the array that passes the truth test (iterator) or the\n value undefined if none passed.\n\n__Example__\n\n```js\nasync.detect(['file1','file2','file3'], fs.exists, function(result){\n // result now equals the first file in the list that exists\n});\n```\n\n---------------------------------------\n\n\n### detectSeries(arr, iterator, callback)\n\nThe same as detect, only the iterator is applied to each item in the array\nin series. This means the result is always the first in the original array (in\nterms of array order) that passes the truth test.\n\n\n---------------------------------------\n\n\n### sortBy(arr, iterator, callback)\n\nSorts a list by the results of running each value through an async iterator.\n\n__Arguments__\n\n* arr - An array to iterate over.\n* iterator(item, callback) - A function to apply to each item in the array.\n The iterator is passed a callback(err, sortValue) which must be called once it\n has completed with an error (which can be null) and a value to use as the sort\n criteria.\n* callback(err, results) - A callback which is called after all the iterator\n functions have finished, or an error has occurred. Results is the items from\n the original array sorted by the values returned by the iterator calls.\n\n__Example__\n\n```js\nasync.sortBy(['file1','file2','file3'], function(file, callback){\n fs.stat(file, function(err, stats){\n callback(err, stats.mtime);\n });\n}, function(err, results){\n // results is now the original array of files sorted by\n // modified date\n});\n```\n\n---------------------------------------\n\n\n### some(arr, iterator, callback)\n\n__Alias:__ any\n\nReturns true if at least one element in the array satisfies an async test.\n_The callback for each iterator call only accepts a single argument of true or\nfalse, it does not accept an error argument first!_ This is in-line with the\nway node libraries work with truth tests like fs.exists. Once any iterator\ncall returns true, the main callback is immediately called.\n\n__Arguments__\n\n* arr - An array to iterate over.\n* iterator(item, callback) - A truth test to apply to each item in the array.\n The iterator is passed a callback(truthValue) which must be called with a \n boolean argument once it has completed.\n* callback(result) - A callback which is called as soon as any iterator returns\n true, or after all the iterator functions have finished. Result will be\n either true or false depending on the values of the async tests.\n\n__Example__\n\n```js\nasync.some(['file1','file2','file3'], fs.exists, function(result){\n // if result is true then at least one of the files exists\n});\n```\n\n---------------------------------------\n\n\n### every(arr, iterator, callback)\n\n__Alias:__ all\n\nReturns true if every element in the array satisfies an async test.\n_The callback for each iterator call only accepts a single argument of true or\nfalse, it does not accept an error argument first!_ This is in-line with the\nway node libraries work with truth tests like fs.exists.\n\n__Arguments__\n\n* arr - An array to iterate over.\n* iterator(item, callback) - A truth test to apply to each item in the array.\n The iterator is passed a callback(truthValue) which must be called with a \n boolean argument once it has completed.\n* callback(result) - A callback which is called after all the iterator\n functions have finished. Result will be either true or false depending on\n the values of the async tests.\n\n__Example__\n\n```js\nasync.every(['file1','file2','file3'], fs.exists, function(result){\n // if result is true then every file exists\n});\n```\n\n---------------------------------------\n\n\n### concat(arr, iterator, callback)\n\nApplies an iterator to each item in a list, concatenating the results. Returns the\nconcatenated list. The iterators are called in parallel, and the results are\nconcatenated as they return. There is no guarantee that the results array will\nbe returned in the original order of the arguments passed to the iterator function.\n\n__Arguments__\n\n* arr - An array to iterate over\n* iterator(item, callback) - A function to apply to each item in the array.\n The iterator is passed a callback(err, results) which must be called once it \n has completed with an error (which can be null) and an array of results.\n* callback(err, results) - A callback which is called after all the iterator\n functions have finished, or an error has occurred. Results is an array containing\n the concatenated results of the iterator function.\n\n__Example__\n\n```js\nasync.concat(['dir1','dir2','dir3'], fs.readdir, function(err, files){\n // files is now a list of filenames that exist in the 3 directories\n});\n```\n\n---------------------------------------\n\n\n### concatSeries(arr, iterator, callback)\n\nSame as async.concat, but executes in series instead of parallel.\n\n\n## Control Flow\n\n\n### series(tasks, [callback])\n\nRun an array of functions in series, each one running once the previous\nfunction has completed. If any functions in the series pass an error to its\ncallback, no more functions are run and the callback for the series is\nimmediately called with the value of the error. Once the tasks have completed,\nthe results are passed to the final callback as an array.\n\nIt is also possible to use an object instead of an array. Each property will be\nrun as a function and the results will be passed to the final callback as an object\ninstead of an array. This can be a more readable way of handling results from\nasync.series.\n\n\n__Arguments__\n\n* tasks - An array or object containing functions to run, each function is passed\n a callback(err, result) it must call on completion with an error (which can\n be null) and an optional result value.\n* callback(err, results) - An optional callback to run once all the functions\n have completed. This function gets a results array (or object) containing all \n the result arguments passed to the task callbacks.\n\n__Example__\n\n```js\nasync.series([\n function(callback){\n // do some stuff ...\n callback(null, 'one');\n },\n function(callback){\n // do some more stuff ...\n callback(null, 'two');\n }\n],\n// optional callback\nfunction(err, results){\n // results is now equal to ['one', 'two']\n});\n\n\n// an example using an object instead of an array\nasync.series({\n one: function(callback){\n setTimeout(function(){\n callback(null, 1);\n }, 200);\n },\n two: function(callback){\n setTimeout(function(){\n callback(null, 2);\n }, 100);\n }\n},\nfunction(err, results) {\n // results is now equal to: {one: 1, two: 2}\n});\n```\n\n---------------------------------------\n\n\n### parallel(tasks, [callback])\n\nRun an array of functions in parallel, without waiting until the previous\nfunction has completed. If any of the functions pass an error to its\ncallback, the main callback is immediately called with the value of the error.\nOnce the tasks have completed, the results are passed to the final callback as an\narray.\n\nIt is also possible to use an object instead of an array. Each property will be\nrun as a function and the results will be passed to the final callback as an object\ninstead of an array. This can be a more readable way of handling results from\nasync.parallel.\n\n\n__Arguments__\n\n* tasks - An array or object containing functions to run, each function is passed \n a callback(err, result) it must call on completion with an error (which can\n be null) and an optional result value.\n* callback(err, results) - An optional callback to run once all the functions\n have completed. This function gets a results array (or object) containing all \n the result arguments passed to the task callbacks.\n\n__Example__\n\n```js\nasync.parallel([\n function(callback){\n setTimeout(function(){\n callback(null, 'one');\n }, 200);\n },\n function(callback){\n setTimeout(function(){\n callback(null, 'two');\n }, 100);\n }\n],\n// optional callback\nfunction(err, results){\n // the results array will equal ['one','two'] even though\n // the second function had a shorter timeout.\n});\n\n\n// an example using an object instead of an array\nasync.parallel({\n one: function(callback){\n setTimeout(function(){\n callback(null, 1);\n }, 200);\n },\n two: function(callback){\n setTimeout(function(){\n callback(null, 2);\n }, 100);\n }\n},\nfunction(err, results) {\n // results is now equals to: {one: 1, two: 2}\n});\n```\n\n---------------------------------------\n\n\n### parallelLimit(tasks, limit, [callback])\n\nThe same as parallel only the tasks are executed in parallel with a maximum of \"limit\" \ntasks executing at any time.\n\nNote that the tasks are not executed in batches, so there is no guarantee that \nthe first \"limit\" tasks will complete before any others are started.\n\n__Arguments__\n\n* tasks - An array or object containing functions to run, each function is passed \n a callback(err, result) it must call on completion with an error (which can\n be null) and an optional result value.\n* limit - The maximum number of tasks to run at any time.\n* callback(err, results) - An optional callback to run once all the functions\n have completed. This function gets a results array (or object) containing all \n the result arguments passed to the task callbacks.\n\n---------------------------------------\n\n\n### whilst(test, fn, callback)\n\nRepeatedly call fn, while test returns true. Calls the callback when stopped,\nor an error occurs.\n\n__Arguments__\n\n* test() - synchronous truth test to perform before each execution of fn.\n* fn(callback) - A function to call each time the test passes. The function is\n passed a callback(err) which must be called once it has completed with an \n optional error argument.\n* callback(err) - A callback which is called after the test fails and repeated\n execution of fn has stopped.\n\n__Example__\n\n```js\nvar count = 0;\n\nasync.whilst(\n function () { return count < 5; },\n function (callback) {\n count++;\n setTimeout(callback, 1000);\n },\n function (err) {\n // 5 seconds have passed\n }\n);\n```\n\n---------------------------------------\n\n\n### doWhilst(fn, test, callback)\n\nThe post check version of whilst. To reflect the difference in the order of operations `test` and `fn` arguments are switched. `doWhilst` is to `whilst` as `do while` is to `while` in plain JavaScript.\n\n---------------------------------------\n\n\n### until(test, fn, callback)\n\nRepeatedly call fn, until test returns true. Calls the callback when stopped,\nor an error occurs.\n\nThe inverse of async.whilst.\n\n---------------------------------------\n\n\n### doUntil(fn, test, callback)\n\nLike doWhilst except the test is inverted. Note the argument ordering differs from `until`.\n\n---------------------------------------\n\n\n### forever(fn, callback)\n\nCalls the asynchronous function 'fn' repeatedly, in series, indefinitely.\nIf an error is passed to fn's callback then 'callback' is called with the\nerror, otherwise it will never be called.\n\n---------------------------------------\n\n\n### waterfall(tasks, [callback])\n\nRuns an array of functions in series, each passing their results to the next in\nthe array. However, if any of the functions pass an error to the callback, the\nnext function is not executed and the main callback is immediately called with\nthe error.\n\n__Arguments__\n\n* tasks - An array of functions to run, each function is passed a \n callback(err, result1, result2, ...) it must call on completion. The first\n argument is an error (which can be null) and any further arguments will be \n passed as arguments in order to the next task.\n* callback(err, [results]) - An optional callback to run once all the functions\n have completed. This will be passed the results of the last task's callback.\n\n\n\n__Example__\n\n```js\nasync.waterfall([\n function(callback){\n callback(null, 'one', 'two');\n },\n function(arg1, arg2, callback){\n callback(null, 'three');\n },\n function(arg1, callback){\n // arg1 now equals 'three'\n callback(null, 'done');\n }\n], function (err, result) {\n // result now equals 'done' \n});\n```\n\n---------------------------------------\n\n### compose(fn1, fn2...)\n\nCreates a function which is a composition of the passed asynchronous\nfunctions. Each function consumes the return value of the function that\nfollows. Composing functions f(), g() and h() would produce the result of\nf(g(h())), only this version uses callbacks to obtain the return values.\n\nEach function is executed with the `this` binding of the composed function.\n\n__Arguments__\n\n* functions... - the asynchronous functions to compose\n\n\n__Example__\n\n```js\nfunction add1(n, callback) {\n setTimeout(function () {\n callback(null, n + 1);\n }, 10);\n}\n\nfunction mul3(n, callback) {\n setTimeout(function () {\n callback(null, n * 3);\n }, 10);\n}\n\nvar add1mul3 = async.compose(mul3, add1);\n\nadd1mul3(4, function (err, result) {\n // result now equals 15\n});\n```\n\n---------------------------------------\n\n### applyEach(fns, args..., callback)\n\nApplies the provided arguments to each function in the array, calling the\ncallback after all functions have completed. If you only provide the first\nargument then it will return a function which lets you pass in the\narguments as if it were a single function call.\n\n__Arguments__\n\n* fns - the asynchronous functions to all call with the same arguments\n* args... - any number of separate arguments to pass to the function\n* callback - the final argument should be the callback, called when all\n functions have completed processing\n\n\n__Example__\n\n```js\nasync.applyEach([enableSearch, updateSchema], 'bucket', callback);\n\n// partial application example:\nasync.each(\n buckets,\n async.applyEach([enableSearch, updateSchema]),\n callback\n);\n```\n\n---------------------------------------\n\n\n### applyEachSeries(arr, iterator, callback)\n\nThe same as applyEach only the functions are applied in series.\n\n---------------------------------------\n\n\n### queue(worker, concurrency)\n\nCreates a queue object with the specified concurrency. Tasks added to the\nqueue will be processed in parallel (up to the concurrency limit). If all\nworkers are in progress, the task is queued until one is available. Once\na worker has completed a task, the task's callback is called.\n\n__Arguments__\n\n* worker(task, callback) - An asynchronous function for processing a queued\n task, which must call its callback(err) argument when finished, with an \n optional error as an argument.\n* concurrency - An integer for determining how many worker functions should be\n run in parallel.\n\n__Queue objects__\n\nThe queue object returned by this function has the following properties and\nmethods:\n\n* length() - a function returning the number of items waiting to be processed.\n* concurrency - an integer for determining how many worker functions should be\n run in parallel. This property can be changed after a queue is created to\n alter the concurrency on-the-fly.\n* push(task, [callback]) - add a new task to the queue, the callback is called\n once the worker has finished processing the task.\n instead of a single task, an array of tasks can be submitted. the respective callback is used for every task in the list.\n* unshift(task, [callback]) - add a new task to the front of the queue.\n* saturated - a callback that is called when the queue length hits the concurrency and further tasks will be queued\n* empty - a callback that is called when the last item from the queue is given to a worker\n* drain - a callback that is called when the last item from the queue has returned from the worker\n\n__Example__\n\n```js\n// create a queue object with concurrency 2\n\nvar q = async.queue(function (task, callback) {\n console.log('hello ' + task.name);\n callback();\n}, 2);\n\n\n// assign a callback\nq.drain = function() {\n console.log('all items have been processed');\n}\n\n// add some items to the queue\n\nq.push({name: 'foo'}, function (err) {\n console.log('finished processing foo');\n});\nq.push({name: 'bar'}, function (err) {\n console.log('finished processing bar');\n});\n\n// add some items to the queue (batch-wise)\n\nq.push([{name: 'baz'},{name: 'bay'},{name: 'bax'}], function (err) {\n console.log('finished processing bar');\n});\n\n// add some items to the front of the queue\n\nq.unshift({name: 'bar'}, function (err) {\n console.log('finished processing bar');\n});\n```\n\n---------------------------------------\n\n\n### cargo(worker, [payload])\n\nCreates a cargo object with the specified payload. Tasks added to the\ncargo will be processed altogether (up to the payload limit). If the\nworker is in progress, the task is queued until it is available. Once\nthe worker has completed some tasks, each callback of those tasks is called.\n\n__Arguments__\n\n* worker(tasks, callback) - An asynchronous function for processing an array of\n queued tasks, which must call its callback(err) argument when finished, with \n an optional error as an argument.\n* payload - An optional integer for determining how many tasks should be\n processed per round; if omitted, the default is unlimited.\n\n__Cargo objects__\n\nThe cargo object returned by this function has the following properties and\nmethods:\n\n* length() - a function returning the number of items waiting to be processed.\n* payload - an integer for determining how many tasks should be\n process per round. This property can be changed after a cargo is created to\n alter the payload on-the-fly.\n* push(task, [callback]) - add a new task to the queue, the callback is called\n once the worker has finished processing the task.\n instead of a single task, an array of tasks can be submitted. the respective callback is used for every task in the list.\n* saturated - a callback that is called when the queue length hits the concurrency and further tasks will be queued\n* empty - a callback that is called when the last item from the queue is given to a worker\n* drain - a callback that is called when the last item from the queue has returned from the worker\n\n__Example__\n\n```js\n// create a cargo object with payload 2\n\nvar cargo = async.cargo(function (tasks, callback) {\n for(var i=0; i\n### auto(tasks, [callback])\n\nDetermines the best order for running functions based on their requirements.\nEach function can optionally depend on other functions being completed first,\nand each function is run as soon as its requirements are satisfied. If any of\nthe functions pass an error to their callback, that function will not complete\n(so any other functions depending on it will not run) and the main callback\nwill be called immediately with the error. Functions also receive an object\ncontaining the results of functions which have completed so far.\n\nNote, all functions are called with a results object as a second argument, \nso it is unsafe to pass functions in the tasks object which cannot handle the\nextra argument. For example, this snippet of code:\n\n```js\nasync.auto({\n readData: async.apply(fs.readFile, 'data.txt', 'utf-8');\n}, callback);\n```\n\nwill have the effect of calling readFile with the results object as the last\nargument, which will fail:\n\n```js\nfs.readFile('data.txt', 'utf-8', cb, {});\n```\n\nInstead, wrap the call to readFile in a function which does not forward the \nresults object:\n\n```js\nasync.auto({\n readData: function(cb, results){\n fs.readFile('data.txt', 'utf-8', cb);\n }\n}, callback);\n```\n\n__Arguments__\n\n* tasks - An object literal containing named functions or an array of\n requirements, with the function itself the last item in the array. The key\n used for each function or array is used when specifying requirements. The \n function receives two arguments: (1) a callback(err, result) which must be \n called when finished, passing an error (which can be null) and the result of \n the function's execution, and (2) a results object, containing the results of\n the previously executed functions.\n* callback(err, results) - An optional callback which is called when all the\n tasks have been completed. The callback will receive an error as an argument\n if any tasks pass an error to their callback. Results will always be passed\n\tbut if an error occurred, no other tasks will be performed, and the results\n\tobject will only contain partial results.\n \n\n__Example__\n\n```js\nasync.auto({\n get_data: function(callback){\n // async code to get some data\n },\n make_folder: function(callback){\n // async code to create a directory to store a file in\n // this is run at the same time as getting the data\n },\n write_file: ['get_data', 'make_folder', function(callback){\n // once there is some data and the directory exists,\n // write the data to a file in the directory\n callback(null, filename);\n }],\n email_link: ['write_file', function(callback, results){\n // once the file is written let's email a link to it...\n // results.write_file contains the filename returned by write_file.\n }]\n});\n```\n\nThis is a fairly trivial example, but to do this using the basic parallel and\nseries functions would look like this:\n\n```js\nasync.parallel([\n function(callback){\n // async code to get some data\n },\n function(callback){\n // async code to create a directory to store a file in\n // this is run at the same time as getting the data\n }\n],\nfunction(err, results){\n async.series([\n function(callback){\n // once there is some data and the directory exists,\n // write the data to a file in the directory\n },\n function(callback){\n // once the file is written let's email a link to it...\n }\n ]);\n});\n```\n\nFor a complicated series of async tasks using the auto function makes adding\nnew tasks much easier and makes the code more readable.\n\n\n---------------------------------------\n\n\n### iterator(tasks)\n\nCreates an iterator function which calls the next function in the array,\nreturning a continuation to call the next one after that. It's also possible to\n'peek' the next iterator by doing iterator.next().\n\nThis function is used internally by the async module but can be useful when\nyou want to manually control the flow of functions in series.\n\n__Arguments__\n\n* tasks - An array of functions to run.\n\n__Example__\n\n```js\nvar iterator = async.iterator([\n function(){ sys.p('one'); },\n function(){ sys.p('two'); },\n function(){ sys.p('three'); }\n]);\n\nnode> var iterator2 = iterator();\n'one'\nnode> var iterator3 = iterator2();\n'two'\nnode> iterator3();\n'three'\nnode> var nextfn = iterator2.next();\nnode> nextfn();\n'three'\n```\n\n---------------------------------------\n\n\n### apply(function, arguments..)\n\nCreates a continuation function with some arguments already applied, a useful\nshorthand when combined with other control flow functions. Any arguments\npassed to the returned function are added to the arguments originally passed\nto apply.\n\n__Arguments__\n\n* function - The function you want to eventually apply all arguments to.\n* arguments... - Any number of arguments to automatically apply when the\n continuation is called.\n\n__Example__\n\n```js\n// using apply\n\nasync.parallel([\n async.apply(fs.writeFile, 'testfile1', 'test1'),\n async.apply(fs.writeFile, 'testfile2', 'test2'),\n]);\n\n\n// the same process without using apply\n\nasync.parallel([\n function(callback){\n fs.writeFile('testfile1', 'test1', callback);\n },\n function(callback){\n fs.writeFile('testfile2', 'test2', callback);\n }\n]);\n```\n\nIt's possible to pass any number of additional arguments when calling the\ncontinuation:\n\n```js\nnode> var fn = async.apply(sys.puts, 'one');\nnode> fn('two', 'three');\none\ntwo\nthree\n```\n\n---------------------------------------\n\n\n### nextTick(callback)\n\nCalls the callback on a later loop around the event loop. In node.js this just\ncalls process.nextTick, in the browser it falls back to setImmediate(callback)\nif available, otherwise setTimeout(callback, 0), which means other higher priority\nevents may precede the execution of the callback.\n\nThis is used internally for browser-compatibility purposes.\n\n__Arguments__\n\n* callback - The function to call on a later loop around the event loop.\n\n__Example__\n\n```js\nvar call_order = [];\nasync.nextTick(function(){\n call_order.push('two');\n // call_order now equals ['one','two']\n});\ncall_order.push('one')\n```\n\n\n### times(n, callback)\n\nCalls the callback n times and accumulates results in the same manner\nyou would use with async.map.\n\n__Arguments__\n\n* n - The number of times to run the function.\n* callback - The function to call n times.\n\n__Example__\n\n```js\n// Pretend this is some complicated async factory\nvar createUser = function(id, callback) {\n callback(null, {\n id: 'user' + id\n })\n}\n// generate 5 users\nasync.times(5, function(n, next){\n createUser(n, function(err, user) {\n next(err, user)\n })\n}, function(err, users) {\n // we should now have 5 users\n});\n```\n\n\n### timesSeries(n, callback)\n\nThe same as times only the iterator is applied to each item in the array in\nseries. The next iterator is only called once the current one has completed\nprocessing. The results array will be in the same order as the original.\n\n\n## Utils\n\n\n### memoize(fn, [hasher])\n\nCaches the results of an async function. When creating a hash to store function\nresults against, the callback is omitted from the hash and an optional hash\nfunction can be used.\n\nThe cache of results is exposed as the `memo` property of the function returned\nby `memoize`.\n\n__Arguments__\n\n* fn - the function you to proxy and cache results from.\n* hasher - an optional function for generating a custom hash for storing\n results, it has all the arguments applied to it apart from the callback, and\n must be synchronous.\n\n__Example__\n\n```js\nvar slow_fn = function (name, callback) {\n // do something\n callback(null, result);\n};\nvar fn = async.memoize(slow_fn);\n\n// fn can now be used as if it were slow_fn\nfn('some name', function () {\n // callback\n});\n```\n\n\n### unmemoize(fn)\n\nUndoes a memoized function, reverting it to the original, unmemoized\nform. Comes handy in tests.\n\n__Arguments__\n\n* fn - the memoized function\n\n\n### log(function, arguments)\n\nLogs the result of an async function to the console. Only works in node.js or\nin browsers that support console.log and console.error (such as FF and Chrome).\nIf multiple arguments are returned from the async function, console.log is\ncalled on each argument in order.\n\n__Arguments__\n\n* function - The function you want to eventually apply all arguments to.\n* arguments... - Any number of arguments to apply to the function.\n\n__Example__\n\n```js\nvar hello = function(name, callback){\n setTimeout(function(){\n callback(null, 'hello ' + name);\n }, 1000);\n};\n```\n```js\nnode> async.log(hello, 'world');\n'hello world'\n```\n\n---------------------------------------\n\n\n### dir(function, arguments)\n\nLogs the result of an async function to the console using console.dir to\ndisplay the properties of the resulting object. Only works in node.js or\nin browsers that support console.dir and console.error (such as FF and Chrome).\nIf multiple arguments are returned from the async function, console.dir is\ncalled on each argument in order.\n\n__Arguments__\n\n* function - The function you want to eventually apply all arguments to.\n* arguments... - Any number of arguments to apply to the function.\n\n__Example__\n\n```js\nvar hello = function(name, callback){\n setTimeout(function(){\n callback(null, {hello: name});\n }, 1000);\n};\n```\n```js\nnode> async.dir(hello, 'world');\n{hello: 'world'}\n```\n\n---------------------------------------\n\n\n### noConflict()\n\nChanges the value of async back to its original value, returning a reference to the\nasync object.\n",
+ "_id": "async@0.2.9",
+ "dist": {
+ "shasum": "0c284b6d60cdb1069d75c3db6108c8a7f0d64798"
+ },
+ "_from": "async@~0.2.9"
+}
diff --git a/node_modules/jsftp/node_modules/event-stream/.npmignore b/node_modules/jsftp/node_modules/event-stream/.npmignore
new file mode 100644
index 0000000..13abef4
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/.npmignore
@@ -0,0 +1,3 @@
+node_modules
+node_modules/*
+npm_debug.log
diff --git a/node_modules/jsftp/node_modules/event-stream/.travis.yml b/node_modules/jsftp/node_modules/event-stream/.travis.yml
new file mode 100644
index 0000000..895dbd3
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/.travis.yml
@@ -0,0 +1,4 @@
+language: node_js
+node_js:
+ - 0.6
+ - 0.8
diff --git a/node_modules/jsftp/node_modules/event-stream/LICENCE b/node_modules/jsftp/node_modules/event-stream/LICENCE
new file mode 100644
index 0000000..171dd97
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/LICENCE
@@ -0,0 +1,22 @@
+Copyright (c) 2011 Dominic Tarr
+
+Permission is hereby granted, free of charge,
+to any person obtaining a copy of this software and
+associated documentation files (the "Software"), to
+deal in the Software without restriction, including
+without limitation the rights to use, copy, modify,
+merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom
+the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice
+shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file
diff --git a/node_modules/jsftp/node_modules/event-stream/examples/pretty.js b/node_modules/jsftp/node_modules/event-stream/examples/pretty.js
new file mode 100644
index 0000000..af04340
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/examples/pretty.js
@@ -0,0 +1,25 @@
+
+var inspect = require('util').inspect
+
+if(!module.parent) {
+ var es = require('..') //load event-stream
+ es.pipe( //pipe joins streams together
+ process.openStdin(), //open stdin
+ es.split(), //split stream to break on newlines
+ es.map(function (data, callback) {//turn this async function into a stream
+ var j
+ try {
+ j = JSON.parse(data) //try to parse input into json
+ } catch (err) {
+ return callback(null, data) //if it fails just pass it anyway
+ }
+ callback(null, inspect(j)) //render it nicely
+ }),
+ process.stdout // pipe it to stdout !
+ )
+ }
+
+// run this
+//
+// curl -sS registry.npmjs.org/event-stream | node pretty.js
+//
diff --git a/node_modules/jsftp/node_modules/event-stream/index.js b/node_modules/jsftp/node_modules/event-stream/index.js
new file mode 100644
index 0000000..a7c05bb
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/index.js
@@ -0,0 +1,302 @@
+//filter will reemit the data if cb(err,pass) pass is truthy
+
+// reduce is more tricky
+// maybe we want to group the reductions or emit progress updates occasionally
+// the most basic reduce just emits one 'data' event after it has recieved 'end'
+
+var Stream = require('stream').Stream
+ , es = exports
+ , through = require('through')
+ , from = require('from')
+ , duplex = require('duplexer')
+ , map = require('map-stream')
+ , pause = require('pause-stream')
+ , split = require('split')
+ , pipeline = require('stream-combiner')
+
+es.Stream = Stream //re-export Stream from core
+es.through = through
+es.from = from
+es.duplex = duplex
+es.map = map
+es.pause = pause
+es.split = split
+es.pipeline = es.connect = es.pipe = pipeline
+// merge / concat
+//
+// combine multiple streams into a single stream.
+// will emit end only once
+
+es.concat = //actually this should be called concat
+es.merge = function (/*streams...*/) {
+ var toMerge = [].slice.call(arguments)
+ var stream = new Stream()
+ var endCount = 0
+ stream.writable = stream.readable = true
+
+ toMerge.forEach(function (e) {
+ e.pipe(stream, {end: false})
+ var ended = false
+ e.on('end', function () {
+ if(ended) return
+ ended = true
+ endCount ++
+ if(endCount == toMerge.length)
+ stream.emit('end')
+ })
+ })
+ stream.write = function (data) {
+ this.emit('data', data)
+ }
+ stream.destroy = function () {
+ merge.forEach(function (e) {
+ if(e.destroy) e.destroy()
+ })
+ }
+ return stream
+}
+
+
+// writable stream, collects all events into an array
+// and calls back when 'end' occurs
+// mainly I'm using this to test the other functions
+
+es.writeArray = function (done) {
+ if ('function' !== typeof done)
+ throw new Error('function writeArray (done): done must be function')
+
+ var a = new Stream ()
+ , array = [], isDone = false
+ a.write = function (l) {
+ array.push(l)
+ }
+ a.end = function () {
+ isDone = true
+ done(null, array)
+ }
+ a.writable = true
+ a.readable = false
+ a.destroy = function () {
+ a.writable = a.readable = false
+ if(isDone) return
+ done(new Error('destroyed before end'), array)
+ }
+ return a
+}
+
+//return a Stream that reads the properties of an object
+//respecting pause() and resume()
+
+es.readArray = function (array) {
+ var stream = new Stream()
+ , i = 0
+ , paused = false
+ , ended = false
+
+ stream.readable = true
+ stream.writable = false
+
+ if(!Array.isArray(array))
+ throw new Error('event-stream.read expects an array')
+
+ stream.resume = function () {
+ if(ended) return
+ paused = false
+ var l = array.length
+ while(i < l && !paused && !ended) {
+ stream.emit('data', array[i++])
+ }
+ if(i == l && !ended)
+ ended = true, stream.readable = false, stream.emit('end')
+ }
+ process.nextTick(stream.resume)
+ stream.pause = function () {
+ paused = true
+ }
+ stream.destroy = function () {
+ ended = true
+ stream.emit('close')
+ }
+ return stream
+}
+
+//
+// readable (asyncFunction)
+// return a stream that calls an async function while the stream is not paused.
+//
+// the function must take: (count, callback) {...
+//
+
+es.readable =
+function (func, continueOnError) {
+ var stream = new Stream()
+ , i = 0
+ , paused = false
+ , ended = false
+ , reading = false
+
+ stream.readable = true
+ stream.writable = false
+
+ if('function' !== typeof func)
+ throw new Error('event-stream.readable expects async function')
+
+ stream.on('end', function () { ended = true })
+
+ function get (err, data) {
+
+ if(err) {
+ stream.emit('error', err)
+ if(!continueOnError) stream.emit('end')
+ } else if (arguments.length > 1)
+ stream.emit('data', data)
+
+ process.nextTick(function () {
+ if(ended || paused || reading) return
+ try {
+ reading = true
+ func.call(stream, i++, function () {
+ reading = false
+ get.apply(null, arguments)
+ })
+ } catch (err) {
+ stream.emit('error', err)
+ }
+ })
+ }
+ stream.resume = function () {
+ paused = false
+ get()
+ }
+ process.nextTick(get)
+ stream.pause = function () {
+ paused = true
+ }
+ stream.destroy = function () {
+ stream.emit('end')
+ stream.emit('close')
+ ended = true
+ }
+ return stream
+}
+
+
+//
+// map sync
+//
+
+es.mapSync = function (sync) {
+ return es.through(function write(data) {
+ var mappedData = sync(data)
+ if (typeof mappedData !== 'undefined')
+ this.emit('data', mappedData)
+ })
+}
+
+//
+// log just print out what is coming through the stream, for debugging
+//
+
+es.log = function (name) {
+ return es.through(function (data) {
+ var args = [].slice.call(arguments)
+ if(name) console.error(name, data)
+ else console.error(data)
+ this.emit('data', data)
+ })
+}
+
+
+//
+// child -- pipe through a child process
+//
+
+es.child = function (child) {
+
+ return es.duplex(child.stdin, child.stdout)
+
+}
+
+//
+// parse
+//
+// must be used after es.split() to ensure that each chunk represents a line
+// source.pipe(es.split()).pipe(es.parse())
+
+es.parse = function () {
+ return es.through(function (data) {
+ var obj
+ try {
+ if(data) //ignore empty lines
+ obj = JSON.parse(data.toString())
+ } catch (err) {
+ return console.error(err, 'attemping to parse:', data)
+ }
+ //ignore lines that where only whitespace.
+ if(obj !== undefined)
+ this.emit('data', obj)
+ })
+}
+//
+// stringify
+//
+
+es.stringify = function () {
+ var Buffer = require('buffer').Buffer
+ return es.mapSync(function (e){
+ return JSON.stringify(Buffer.isBuffer(e) ? e.toString() : e) + '\n'
+ })
+}
+
+//
+// replace a string within a stream.
+//
+// warn: just concatenates the string and then does str.split().join().
+// probably not optimal.
+// for smallish responses, who cares?
+// I need this for shadow-npm so it's only relatively small json files.
+
+es.replace = function (from, to) {
+ return es.pipeline(es.split(from), es.join(to))
+}
+
+//
+// join chunks with a joiner. just like Array#join
+// also accepts a callback that is passed the chunks appended together
+// this is still supported for legacy reasons.
+//
+
+es.join = function (str) {
+
+ //legacy api
+ if('function' === typeof str)
+ return es.wait(str)
+
+ var first = true
+ return es.through(function (data) {
+ if(!first)
+ this.emit('data', str)
+ first = false
+ this.emit('data', data)
+ return true
+ })
+}
+
+
+//
+// wait. callback when 'end' is emitted, with all chunks appended as string.
+//
+
+es.wait = function (callback) {
+ var body = ''
+ return es.through(function (data) { body += data },
+ function () {
+ this.emit('data', body)
+ this.emit('end')
+ if(callback) callback(null, body)
+ })
+}
+
+es.pipeable = function () {
+ throw new Error('[EVENT-STREAM] es.pipeable is deprecated')
+}
diff --git a/node_modules/jsftp/node_modules/event-stream/node_modules/duplexer/.npmignore b/node_modules/jsftp/node_modules/event-stream/node_modules/duplexer/.npmignore
new file mode 100644
index 0000000..062c11e
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/node_modules/duplexer/.npmignore
@@ -0,0 +1,3 @@
+node_modules
+*.log
+*.err
\ No newline at end of file
diff --git a/node_modules/jsftp/node_modules/event-stream/node_modules/duplexer/.travis.yml b/node_modules/jsftp/node_modules/event-stream/node_modules/duplexer/.travis.yml
new file mode 100644
index 0000000..c2ba3f9
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/node_modules/duplexer/.travis.yml
@@ -0,0 +1,3 @@
+language: node_js
+node_js:
+ - 0.8
\ No newline at end of file
diff --git a/node_modules/jsftp/node_modules/event-stream/node_modules/duplexer/LICENCE b/node_modules/jsftp/node_modules/event-stream/node_modules/duplexer/LICENCE
new file mode 100644
index 0000000..a23e08a
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/node_modules/duplexer/LICENCE
@@ -0,0 +1,19 @@
+Copyright (c) 2012 Raynos.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
\ No newline at end of file
diff --git a/node_modules/jsftp/node_modules/event-stream/node_modules/duplexer/Makefile b/node_modules/jsftp/node_modules/event-stream/node_modules/duplexer/Makefile
new file mode 100644
index 0000000..1f8985d
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/node_modules/duplexer/Makefile
@@ -0,0 +1,4 @@
+test:
+ node test.js
+
+.PHONY: test
\ No newline at end of file
diff --git a/node_modules/jsftp/node_modules/event-stream/node_modules/duplexer/README.md b/node_modules/jsftp/node_modules/event-stream/node_modules/duplexer/README.md
new file mode 100644
index 0000000..a24cecb
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/node_modules/duplexer/README.md
@@ -0,0 +1,36 @@
+# duplexer [![build status][1]][2]
+
+Creates a duplex stream
+
+Taken from [event-stream][3]
+
+## duplex (writeStream, readStream)
+
+Takes a writable stream and a readable stream and makes them appear as a readable writable stream.
+
+It is assumed that the two streams are connected to each other in some way.
+
+## Example
+
+ var grep = cp.exec('grep Stream')
+
+ duplex(grep.stdin, grep.stdout)
+
+## Installation
+
+`npm install duplexer`
+
+## Tests
+
+`make test`
+
+## Contributors
+
+ - Dominictarr
+ - Raynos
+
+## MIT Licenced
+
+ [1]: https://secure.travis-ci.org/Raynos/duplexer.png
+ [2]: http://travis-ci.org/Raynos/duplexer
+ [3]: https://github.com/dominictarr/event-stream#duplex-writestream-readstream
\ No newline at end of file
diff --git a/node_modules/jsftp/node_modules/event-stream/node_modules/duplexer/index.js b/node_modules/jsftp/node_modules/event-stream/node_modules/duplexer/index.js
new file mode 100644
index 0000000..22e0d51
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/node_modules/duplexer/index.js
@@ -0,0 +1,77 @@
+var Stream = require("stream")
+ , writeMethods = ["write", "end", "destroy"]
+ , readMethods = ["resume", "pause"]
+ , readEvents = ["data", "close"]
+ , slice = Array.prototype.slice
+
+module.exports = duplex
+
+function duplex(writer, reader) {
+ var stream = new Stream()
+ , ended = false
+
+ writeMethods.forEach(proxyWriter)
+
+ readMethods.forEach(proxyReader)
+
+ readEvents.forEach(proxyStream)
+
+ reader.on("end", handleEnd)
+
+ writer.on("drain", function() {
+ stream.emit("drain")
+ })
+
+ writer.on("error", reemit)
+ reader.on("error", reemit)
+
+ stream.writable = writer.writable
+ stream.readable = reader.readable
+
+ return stream
+
+ function proxyWriter(methodName) {
+ stream[methodName] = method
+
+ function method() {
+ return writer[methodName].apply(writer, arguments)
+ }
+ }
+
+ function proxyReader(methodName) {
+ stream[methodName] = method
+
+ function method() {
+ stream.emit(methodName)
+ var func = reader[methodName]
+ if (func) {
+ return func.apply(reader, arguments)
+ }
+ reader.emit(methodName)
+ }
+ }
+
+ function proxyStream(methodName) {
+ reader.on(methodName, reemit)
+
+ function reemit() {
+ var args = slice.call(arguments)
+ args.unshift(methodName)
+ stream.emit.apply(stream, args)
+ }
+ }
+
+ function handleEnd() {
+ if (ended) {
+ return
+ }
+ ended = true
+ var args = slice.call(arguments)
+ args.unshift("end")
+ stream.emit.apply(stream, args)
+ }
+
+ function reemit(err) {
+ stream.emit("error", err)
+ }
+}
diff --git a/node_modules/jsftp/node_modules/event-stream/node_modules/duplexer/package.json b/node_modules/jsftp/node_modules/event-stream/node_modules/duplexer/package.json
new file mode 100644
index 0000000..b0cb5e3
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/node_modules/duplexer/package.json
@@ -0,0 +1,44 @@
+{
+ "name": "duplexer",
+ "version": "0.0.4",
+ "description": "Creates a duplex stream",
+ "keywords": [],
+ "author": {
+ "name": "Raynos",
+ "email": "raynos2@gmail.com"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/Raynos/duplexer.git"
+ },
+ "main": "index",
+ "homepage": "https://github.com/Raynos/duplexer",
+ "contributors": [
+ {
+ "name": "Jake Verbaten"
+ }
+ ],
+ "bugs": {
+ "url": "https://github.com/Raynos/duplexer/issues",
+ "email": "raynos2@gmail.com"
+ },
+ "dependencies": {},
+ "devDependencies": {
+ "through": "~0.1.4"
+ },
+ "licenses": [
+ {
+ "type": "MIT",
+ "url": "http://github.com/Raynos/duplexer/raw/master/LICENSE"
+ }
+ ],
+ "scripts": {
+ "test": "make test"
+ },
+ "readme": "# duplexer [![build status][1]][2]\n\nCreates a duplex stream\n\nTaken from [event-stream][3]\n\n## duplex (writeStream, readStream)\n\nTakes a writable stream and a readable stream and makes them appear as a readable writable stream.\n\nIt is assumed that the two streams are connected to each other in some way.\n\n## Example\n\n var grep = cp.exec('grep Stream')\n\n duplex(grep.stdin, grep.stdout)\n\n## Installation\n\n`npm install duplexer`\n\n## Tests\n\n`make test`\n\n## Contributors\n\n - Dominictarr\n - Raynos\n\n## MIT Licenced\n\n [1]: https://secure.travis-ci.org/Raynos/duplexer.png\n [2]: http://travis-ci.org/Raynos/duplexer\n [3]: https://github.com/dominictarr/event-stream#duplex-writestream-readstream",
+ "_id": "duplexer@0.0.4",
+ "dist": {
+ "shasum": "49e7655791cdb887f4ce1616756bbb5f65d96157"
+ },
+ "_from": "duplexer@~0.0.2"
+}
diff --git a/node_modules/jsftp/node_modules/event-stream/node_modules/duplexer/test.js b/node_modules/jsftp/node_modules/event-stream/node_modules/duplexer/test.js
new file mode 100644
index 0000000..e06a864
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/node_modules/duplexer/test.js
@@ -0,0 +1,27 @@
+var duplex = require("./index")
+ , assert = require("assert")
+ , through = require("through")
+
+var readable = through()
+ , writable = through(write)
+ , written = 0
+ , data = 0
+
+var stream = duplex(writable, readable)
+
+function write() {
+ written++
+}
+
+stream.on("data", ondata)
+
+function ondata() {
+ data++
+}
+
+stream.write()
+readable.emit("data")
+
+assert.equal(written, 1)
+assert.equal(data, 1)
+console.log("DONE")
\ No newline at end of file
diff --git a/node_modules/jsftp/node_modules/event-stream/node_modules/from/.npmignore b/node_modules/jsftp/node_modules/event-stream/node_modules/from/.npmignore
new file mode 100644
index 0000000..3c3629e
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/node_modules/from/.npmignore
@@ -0,0 +1 @@
+node_modules
diff --git a/node_modules/jsftp/node_modules/event-stream/node_modules/from/LICENSE.APACHE2 b/node_modules/jsftp/node_modules/event-stream/node_modules/from/LICENSE.APACHE2
new file mode 100644
index 0000000..6366c04
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/node_modules/from/LICENSE.APACHE2
@@ -0,0 +1,15 @@
+Apache License, Version 2.0
+
+Copyright (c) 2011 Dominic Tarr
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
diff --git a/node_modules/jsftp/node_modules/event-stream/node_modules/from/LICENSE.MIT b/node_modules/jsftp/node_modules/event-stream/node_modules/from/LICENSE.MIT
new file mode 100644
index 0000000..6eafbd7
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/node_modules/from/LICENSE.MIT
@@ -0,0 +1,24 @@
+The MIT License
+
+Copyright (c) 2011 Dominic Tarr
+
+Permission is hereby granted, free of charge,
+to any person obtaining a copy of this software and
+associated documentation files (the "Software"), to
+deal in the Software without restriction, including
+without limitation the rights to use, copy, modify,
+merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom
+the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice
+shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/jsftp/node_modules/event-stream/node_modules/from/index.js b/node_modules/jsftp/node_modules/event-stream/node_modules/from/index.js
new file mode 100644
index 0000000..bba40da
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/node_modules/from/index.js
@@ -0,0 +1,68 @@
+
+'use strict';
+
+var Stream = require('stream')
+
+// from
+//
+// a stream that reads from an source.
+// source may be an array, or a function.
+// from handles pause behaviour for you.
+
+module.exports =
+function from (source) {
+ if(Array.isArray(source)) {
+ source = source.slice()
+ return from (function (i) {
+ if(source.length)
+ this.emit('data', source.shift())
+ else
+ this.emit('end')
+ return true
+ })
+ }
+ var s = new Stream(), i = 0
+ s.ended = false
+ s.started = false
+ s.readable = true
+ s.writable = false
+ s.paused = false
+ s.ended = false
+ s.pause = function () {
+ s.started = true
+ s.paused = true
+ }
+ function next () {
+ s.started = true
+ if(s.ended) return
+ while(!s.ended && !s.paused && source.call(s, i++, function () {
+ if(!s.ended && !s.paused)
+ next()
+ }))
+ ;
+ }
+ s.resume = function () {
+ s.started = true
+ s.paused = false
+ next()
+ }
+ s.on('end', function () {
+ s.ended = true
+ s.readable = false
+ process.nextTick(s.destroy)
+ })
+ s.destroy = function () {
+ s.ended = true
+ s.emit('close')
+ }
+ /*
+ by default, the stream will start emitting at nextTick
+ if you want, you can pause it, after pipeing.
+ you can also resume before next tick, and that will also
+ work.
+ */
+ process.nextTick(function () {
+ if(!s.started) s.resume()
+ })
+ return s
+}
diff --git a/node_modules/jsftp/node_modules/event-stream/node_modules/from/package.json b/node_modules/jsftp/node_modules/event-stream/node_modules/from/package.json
new file mode 100644
index 0000000..114327f
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/node_modules/from/package.json
@@ -0,0 +1,36 @@
+{
+ "name": "from",
+ "version": "0.1.3",
+ "description": "Easy way to make a Readable Stream",
+ "main": "index.js",
+ "scripts": {
+ "test": "asynct test/*.js"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/dominictarr/from.git"
+ },
+ "keywords": [
+ "stream",
+ "streams",
+ "readable",
+ "easy"
+ ],
+ "devDependencies": {
+ "asynct": "1",
+ "stream-spec": "0",
+ "assertions": "~2.3.0"
+ },
+ "author": {
+ "name": "Dominic Tarr",
+ "email": "dominic.tarr@gmail.com",
+ "url": "dominictarr.com"
+ },
+ "license": "MIT",
+ "readme": "# from\n\nAn easy way to create a `readable Stream`.\n\n## from(function getChunk(count, next))\n\nfrom takes a `getChunk` function and returns a stream. \n\n`getChunk` is called again and again, after each time the user calls `next()`, \nuntil the user emits `'end'`\n\nif `pause()` is called, the `getChunk` won't be called again untill `resume()` is called.\n\n\n```js\nvar from = require('from')\n\nvar stream = \n from(function getChunk(count, next) {\n //do some sort of data\n this.emit('data', whatever)\n \n if(itsOver)\n this.emit('end')\n\n //ready to handle the next chunk\n next()\n //or, if it's sync:\n return true \n })\n```\n\n## from(array)\n\nfrom also takes an `Array` whose elements it emits one after another.\n\n## License\nMIT / Apache2\n",
+ "_id": "from@0.1.3",
+ "dist": {
+ "shasum": "0ac5c9c9018c3f249f72e92396f3e5f25aa6fdbd"
+ },
+ "_from": "from@~0"
+}
diff --git a/node_modules/jsftp/node_modules/event-stream/node_modules/from/readme.markdown b/node_modules/jsftp/node_modules/event-stream/node_modules/from/readme.markdown
new file mode 100644
index 0000000..a619163
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/node_modules/from/readme.markdown
@@ -0,0 +1,38 @@
+# from
+
+An easy way to create a `readable Stream`.
+
+## from(function getChunk(count, next))
+
+from takes a `getChunk` function and returns a stream.
+
+`getChunk` is called again and again, after each time the user calls `next()`,
+until the user emits `'end'`
+
+if `pause()` is called, the `getChunk` won't be called again untill `resume()` is called.
+
+
+```js
+var from = require('from')
+
+var stream =
+ from(function getChunk(count, next) {
+ //do some sort of data
+ this.emit('data', whatever)
+
+ if(itsOver)
+ this.emit('end')
+
+ //ready to handle the next chunk
+ next()
+ //or, if it's sync:
+ return true
+ })
+```
+
+## from(array)
+
+from also takes an `Array` whose elements it emits one after another.
+
+## License
+MIT / Apache2
diff --git a/node_modules/jsftp/node_modules/event-stream/node_modules/from/test/index.js b/node_modules/jsftp/node_modules/event-stream/node_modules/from/test/index.js
new file mode 100644
index 0000000..fafea57
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/node_modules/from/test/index.js
@@ -0,0 +1,141 @@
+var from = require('..')
+var spec = require('stream-spec')
+var a = require('assertions')
+
+function read(stream, callback) {
+ var actual = []
+ stream.on('data', function (data) {
+ actual.push(data)
+ })
+ stream.once('end', function () {
+ callback(null, actual)
+ })
+ stream.once('error', function (err) {
+ callback(err)
+ })
+}
+
+function pause(stream) {
+ stream.on('data', function () {
+ if(Math.random() > 0.1) return
+ stream.pause()
+ process.nextTick(function () {
+ stream.resume()
+ })
+ })
+}
+
+exports['inc'] = function (test) {
+
+ var fs = from(function (i) {
+ this.emit('data', i)
+ if(i >= 99)
+ return this.emit('end')
+ return true
+ })
+
+ spec(fs).readable().validateOnExit()
+
+ read(fs, function (err, arr) {
+ test.equal(arr.length, 100)
+ test.done()
+ })
+}
+
+exports['simple'] = function (test) {
+
+ var l = 1000
+ , expected = []
+
+ while(l--) expected.push(l * Math.random())
+
+ var t = from(expected.slice())
+
+ spec(t)
+ .readable()
+ .pausable({strict: true})
+ .validateOnExit()
+
+ read(t, function (err, actual) {
+ if(err) test.error(err) //fail
+ a.deepEqual(actual, expected)
+ test.done()
+ })
+
+}
+
+exports['simple pausable'] = function (test) {
+
+ var l = 1000
+ , expected = []
+
+ while(l--) expected.push(l * Math.random())
+
+ var t = from(expected.slice())
+
+ spec(t)
+ .readable()
+ .pausable({strict: true})
+ .validateOnExit()
+
+ pause(t)
+
+ read(t, function (err, actual) {
+ if(err) test.error(err) //fail
+ a.deepEqual(actual, expected)
+ test.done()
+ })
+
+}
+
+exports['simple (not strictly pausable) setTimeout'] = function (test) {
+
+ var l = 10
+ , expected = []
+ while(l--) expected.push(l * Math.random())
+
+
+ var _expected = expected.slice()
+ var t = from(function (i, n) {
+ var self = this
+ setTimeout(function () {
+ if(_expected.length)
+ self.emit('data', _expected.shift())
+ else
+ self.emit('end')
+ n()
+ }, 3)
+ })
+
+ /*
+ using from in this way will not be strictly pausable.
+ it could be extended to buffer outputs, but I think a better
+ way would be to use a PauseStream that implements strict pause.
+ */
+
+ spec(t)
+ .readable()
+ .pausable({strict: false })
+ .validateOnExit()
+
+ //pause(t)
+ var paused = false
+ var i = setInterval(function () {
+ if(!paused) t.pause()
+ else t.resume()
+ paused = !paused
+ }, 2)
+
+ t.on('end', function () {
+ clearInterval(i)
+ })
+
+ read(t, function (err, actual) {
+ if(err) test.error(err) //fail
+ a.deepEqual(actual, expected)
+ test.done()
+ })
+
+}
+
+
diff --git a/node_modules/jsftp/node_modules/event-stream/node_modules/map-stream/.npmignore b/node_modules/jsftp/node_modules/event-stream/node_modules/map-stream/.npmignore
new file mode 100644
index 0000000..13abef4
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/node_modules/map-stream/.npmignore
@@ -0,0 +1,3 @@
+node_modules
+node_modules/*
+npm_debug.log
diff --git a/node_modules/jsftp/node_modules/event-stream/node_modules/map-stream/.travis.yml b/node_modules/jsftp/node_modules/event-stream/node_modules/map-stream/.travis.yml
new file mode 100644
index 0000000..895dbd3
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/node_modules/map-stream/.travis.yml
@@ -0,0 +1,4 @@
+language: node_js
+node_js:
+ - 0.6
+ - 0.8
diff --git a/node_modules/jsftp/node_modules/event-stream/node_modules/map-stream/LICENCE b/node_modules/jsftp/node_modules/event-stream/node_modules/map-stream/LICENCE
new file mode 100644
index 0000000..171dd97
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/node_modules/map-stream/LICENCE
@@ -0,0 +1,22 @@
+Copyright (c) 2011 Dominic Tarr
+
+Permission is hereby granted, free of charge,
+to any person obtaining a copy of this software and
+associated documentation files (the "Software"), to
+deal in the Software without restriction, including
+without limitation the rights to use, copy, modify,
+merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom
+the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice
+shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file
diff --git a/node_modules/jsftp/node_modules/event-stream/node_modules/map-stream/examples/pretty.js b/node_modules/jsftp/node_modules/event-stream/node_modules/map-stream/examples/pretty.js
new file mode 100644
index 0000000..ab07398
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/node_modules/map-stream/examples/pretty.js
@@ -0,0 +1,26 @@
+
+var inspect = require('util').inspect
+
+if(!module.parent) {
+ var map = require('..') //load map-stream
+ var es = require('event-stream') //load event-stream
+ es.pipe( //pipe joins streams together
+ process.openStdin(), //open stdin
+ es.split(), //split stream to break on newlines
+ map(function (data, callback) { //turn this async function into a stream
+ var j
+ try {
+ j = JSON.parse(data) //try to parse input into json
+ } catch (err) {
+ return callback(null, data) //if it fails just pass it anyway
+ }
+ callback(null, inspect(j)) //render it nicely
+ }),
+ process.stdout // pipe it to stdout !
+ )
+ }
+
+// run this
+//
+// curl -sS registry.npmjs.org/event-stream | node pretty.js
+//
diff --git a/node_modules/jsftp/node_modules/event-stream/node_modules/map-stream/index.js b/node_modules/jsftp/node_modules/event-stream/node_modules/map-stream/index.js
new file mode 100644
index 0000000..d3a7fd9
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/node_modules/map-stream/index.js
@@ -0,0 +1,105 @@
+//filter will reemit the data if cb(err,pass) pass is truthy
+
+// reduce is more tricky
+// maybe we want to group the reductions or emit progress updates occasionally
+// the most basic reduce just emits one 'data' event after it has recieved 'end'
+
+
+var Stream = require('stream').Stream
+
+
+//create an event stream and apply function to each .write
+//emitting each response as data
+//unless it's an empty callback
+
+module.exports = function (mapper) {
+ var stream = new Stream()
+ , inputs = 0
+ , outputs = 0
+ , ended = false
+ , paused = false
+ , destroyed = false
+
+ stream.writable = true
+ stream.readable = true
+
+ stream.write = function () {
+ if(ended) throw new Error('map stream is not writable')
+ inputs ++
+ var args = [].slice.call(arguments)
+ , r
+ , inNext = false
+ //pipe only allows one argument. so, do not
+ function next (err) {
+ if(destroyed) return
+ inNext = true
+ outputs ++
+ var args = [].slice.call(arguments)
+ if(err) {
+ args.unshift('error')
+ return inNext = false, stream.emit.apply(stream, args)
+ }
+ args.shift() //drop err
+ if (args.length) {
+ args.unshift('data')
+ r = stream.emit.apply(stream, args)
+ }
+ if(inputs == outputs) {
+ if(paused) paused = false, stream.emit('drain') //written all the incoming events
+ if(ended) end()
+ }
+ inNext = false
+ }
+ args.push(next)
+
+ try {
+ //catch sync errors and handle them like async errors
+ var written = mapper.apply(null, args)
+ paused = (written === false)
+ return !paused
+ } catch (err) {
+ //if the callback has been called syncronously, and the error
+ //has occured in an listener, throw it again.
+ if(inNext)
+ throw err
+ next(err)
+ return !paused
+ }
+ }
+
+ function end (data) {
+ //if end was called with args, write it,
+ ended = true //write will emit 'end' if ended is true
+ stream.writable = false
+ if(data !== undefined)
+ return stream.write(data)
+ else if (inputs == outputs) //wait for processing
+ stream.readable = false, stream.emit('end'), stream.destroy()
+ }
+
+ stream.end = function (data) {
+ if(ended) return
+ end()
+ }
+
+ stream.destroy = function () {
+ ended = destroyed = true
+ stream.writable = stream.readable = paused = false
+ process.nextTick(function () {
+ stream.emit('close')
+ })
+ }
+ stream.pause = function () {
+ paused = true
+ }
+
+ stream.resume = function () {
+ paused = false
+ }
+
+ return stream
+}
+
+
+
+
diff --git a/node_modules/jsftp/node_modules/event-stream/node_modules/map-stream/package.json b/node_modules/jsftp/node_modules/event-stream/node_modules/map-stream/package.json
new file mode 100644
index 0000000..90bdd63
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/node_modules/map-stream/package.json
@@ -0,0 +1,33 @@
+{
+ "name": "map-stream",
+ "version": "0.0.2",
+ "description": "construct pipes of streams of events",
+ "homepage": "http://github.com/dominictarr/map-stream",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/dominictarr/map-stream.git"
+ },
+ "dependencies": {},
+ "devDependencies": {
+ "asynct": "*",
+ "it-is": "1",
+ "ubelt": "~2.9",
+ "stream-spec": "~0.2",
+ "event-stream": "~2.1",
+ "from": "0.0.2"
+ },
+ "scripts": {
+ "test": "asynct test/"
+ },
+ "author": {
+ "name": "Dominic Tarr",
+ "email": "dominic.tarr@gmail.com",
+ "url": "http://dominictarr.com"
+ },
+ "readme": "# MapStream\n\nRefactored out of [event-stream](https://github.com/dominictarr/event-stream)\n\n##map (asyncFunction)\n\nCreate a through stream from an asyncronous function. \n\n``` js\nvar map = require('map-stream')\n\nmap(function (data, callback) {\n //transform data\n // ...\n callback(null, data)\n})\n\n```\n\nEach map MUST call the callback. It may callback with data, with an error or with no arguments, \n\n * `callback()` drop this data. \n this makes the map work like `filter`, \n note:`callback(null,null)` is not the same, and will emit `null`\n\n * `callback(null, newData)` turn data into newData\n \n * `callback(error)` emit an error for this item.\n\n>Note: if a callback is not called, `map` will think that it is still being processed, \n>every call must be answered or the stream will not know when to end. \n>\n>Also, if the callback is called more than once, every call but the first will be ignored.\n\n\n",
+ "_id": "map-stream@0.0.2",
+ "dist": {
+ "shasum": "8c7fc337e11ea95e1e6edc5b18b7e4a2944e2f0f"
+ },
+ "_from": "map-stream@0.0.2"
+}
diff --git a/node_modules/jsftp/node_modules/event-stream/node_modules/map-stream/readme.markdown b/node_modules/jsftp/node_modules/event-stream/node_modules/map-stream/readme.markdown
new file mode 100644
index 0000000..7e54504
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/node_modules/map-stream/readme.markdown
@@ -0,0 +1,35 @@
+# MapStream
+
+Refactored out of [event-stream](https://github.com/dominictarr/event-stream)
+
+##map (asyncFunction)
+
+Create a through stream from an asyncronous function.
+
+``` js
+var map = require('map-stream')
+
+map(function (data, callback) {
+ //transform data
+ // ...
+ callback(null, data)
+})
+
+```
+
+Each map MUST call the callback. It may callback with data, with an error or with no arguments,
+
+ * `callback()` drop this data.
+ this makes the map work like `filter`,
+ note:`callback(null,null)` is not the same, and will emit `null`
+
+ * `callback(null, newData)` turn data into newData
+
+ * `callback(error)` emit an error for this item.
+
+>Note: if a callback is not called, `map` will think that it is still being processed,
+>every call must be answered or the stream will not know when to end.
+>
+>Also, if the callback is called more than once, every call but the first will be ignored.
+
+
diff --git a/node_modules/jsftp/node_modules/event-stream/node_modules/map-stream/test/simple-map.asynct.js b/node_modules/jsftp/node_modules/event-stream/node_modules/map-stream/test/simple-map.asynct.js
new file mode 100644
index 0000000..b04d953
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/node_modules/map-stream/test/simple-map.asynct.js
@@ -0,0 +1,270 @@
+'use strict';
+
+var map = require('../')
+ , it = require('it-is')
+ , u = require('ubelt')
+ , spec = require('stream-spec')
+ , from = require('from')
+ , Stream = require('stream')
+ , es = require('event-stream')
+
+//REFACTOR THIS TEST TO USE es.readArray and es.writeArray
+
+function writeArray(array, stream) {
+
+ array.forEach( function (j) {
+ stream.write(j)
+ })
+ stream.end()
+
+}
+
+function readStream(stream, done) {
+
+ var array = []
+ stream.on('data', function (data) {
+ array.push(data)
+ })
+ stream.on('error', done)
+ stream.on('end', function (data) {
+ done(null, array)
+ })
+
+}
+
+//call sink on each write,
+//and complete when finished.
+
+function pauseStream (prob, delay) {
+ var pauseIf = (
+ 'number' == typeof prob
+ ? function () {
+ return Math.random() < prob
+ }
+ : 'function' == typeof prob
+ ? prob
+ : 0.1
+ )
+ var delayer = (
+ !delay
+ ? process.nextTick
+ : 'number' == typeof delay
+ ? function (next) { setTimeout(next, delay) }
+ : delay
+ )
+
+ return es.through(function (data) {
+ if(!this.paused && pauseIf()) {
+ console.log('PAUSE STREAM PAUSING')
+ this.pause()
+ var self = this
+ delayer(function () {
+ console.log('PAUSE STREAM RESUMING')
+ self.resume()
+ })
+ }
+ console.log("emit ('data', " + data + ')')
+ this.emit('data', data)
+ })
+}
+
+exports ['simple map applied to a stream'] = function (test) {
+
+ var input = [1,2,3,7,5,3,1,9,0,2,4,6]
+ //create event stream from
+
+ var doubler = map(function (data, cb) {
+ cb(null, data * 2)
+ })
+
+ spec(doubler).through().validateOnExit()
+
+ //a map is only a middle man, so it is both readable and writable
+
+ it(doubler).has({
+ readable: true,
+ writable: true,
+ })
+
+ readStream(doubler, function (err, output) {
+ it(output).deepEqual(input.map(function (j) {
+ return j * 2
+ }))
+// process.nextTick(x.validate)
+ test.done()
+ })
+
+ writeArray(input, doubler)
+
+}
+
+exports['pipe two maps together'] = function (test) {
+
+ var input = [1,2,3,7,5,3,1,9,0,2,4,6]
+ //create event stream from
+ function dd (data, cb) {
+ cb(null, data * 2)
+ }
+ var doubler1 = map(dd), doubler2 = map(dd)
+
+ doubler1.pipe(doubler2)
+
+ spec(doubler1).through().validateOnExit()
+ spec(doubler2).through().validateOnExit()
+
+ readStream(doubler2, function (err, output) {
+ it(output).deepEqual(input.map(function (j) {
+ return j * 4
+ }))
+ test.done()
+ })
+
+ writeArray(input, doubler1)
+
+}
+
+//next:
+//
+// test pause, resume and drian.
+//
+
+// then make a pipe joiner:
+//
+// plumber (evStr1, evStr2, evStr3, evStr4, evStr5)
+//
+// will return a single stream that write goes to the first
+
+exports ['map will not call end until the callback'] = function (test) {
+
+ var ticker = map(function (data, cb) {
+ process.nextTick(function () {
+ cb(null, data * 2)
+ })
+ })
+
+ spec(ticker).through().validateOnExit()
+
+ ticker.write('x')
+ ticker.end()
+
+ ticker.on('end', function () {
+ test.done()
+ })
+}
+
+
+exports ['emit error thrown'] = function (test) {
+
+ var err = new Error('INTENSIONAL ERROR')
+ , mapper =
+ map(function () {
+ throw err
+ })
+
+ mapper.on('error', function (_err) {
+ it(_err).equal(err)
+ test.done()
+ })
+
+ mapper.write('hello')
+
+}
+
+exports ['emit error calledback'] = function (test) {
+
+ var err = new Error('INTENSIONAL ERROR')
+ , mapper =
+ map(function (data, callback) {
+ callback(err)
+ })
+
+ mapper.on('error', function (_err) {
+ it(_err).equal(err)
+ test.done()
+ })
+
+ mapper.write('hello')
+
+}
+
+exports ['do not emit drain if not paused'] = function (test) {
+
+ var maps = map(function (data, callback) {
+ u.delay(callback)(null, 1)
+ return true
+ })
+
+ spec(maps).through().pausable().validateOnExit()
+
+ maps.on('drain', function () {
+ it(false).ok('should not emit drain unless the stream is paused')
+ })
+
+ it(maps.write('hello')).equal(true)
+ it(maps.write('hello')).equal(true)
+ it(maps.write('hello')).equal(true)
+ setTimeout(function () {maps.end()},10)
+ maps.on('end', test.done)
+}
+
+exports ['emits drain if paused, when all '] = function (test) {
+ var active = 0
+ var drained = false
+ var maps = map(function (data, callback) {
+ active ++
+ u.delay(function () {
+ active --
+ callback(null, 1)
+ })()
+ console.log('WRITE', false)
+ return false
+ })
+
+ spec(maps).through().validateOnExit()
+
+ maps.on('drain', function () {
+ drained = true
+ it(active).equal(0, 'should emit drain when all maps are done')
+ })
+
+ it(maps.write('hello')).equal(false)
+ it(maps.write('hello')).equal(false)
+ it(maps.write('hello')).equal(false)
+
+ process.nextTick(function () {maps.end()},10)
+
+ maps.on('end', function () {
+ console.log('end')
+ it(drained).ok('shoud have emitted drain before end')
+ test.done()
+ })
+
+}
+
+exports ['map applied to a stream with filtering'] = function (test) {
+
+ var input = [1,2,3,7,5,3,1,9,0,2,4,6]
+
+ var doubler = map(function (data, callback) {
+ if (data % 2)
+ callback(null, data * 2)
+ else
+ callback()
+ })
+
+ readStream(doubler, function (err, output) {
+ it(output).deepEqual(input.filter(function (j) {
+ return j % 2
+ }).map(function (j) {
+ return j * 2
+ }))
+ test.done()
+ })
+
+ spec(doubler).through().validateOnExit()
+
+ writeArray(input, doubler)
+
+}
+
+
diff --git a/node_modules/jsftp/node_modules/event-stream/node_modules/pause-stream/.npmignore b/node_modules/jsftp/node_modules/event-stream/node_modules/pause-stream/.npmignore
new file mode 100644
index 0000000..13abef4
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/node_modules/pause-stream/.npmignore
@@ -0,0 +1,3 @@
+node_modules
+node_modules/*
+npm_debug.log
diff --git a/node_modules/jsftp/node_modules/event-stream/node_modules/pause-stream/index.js b/node_modules/jsftp/node_modules/event-stream/node_modules/pause-stream/index.js
new file mode 100644
index 0000000..0e0bf96
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/node_modules/pause-stream/index.js
@@ -0,0 +1,3 @@
+//through@2 handles this by default!
+module.exports = require('through')
+
diff --git a/node_modules/jsftp/node_modules/event-stream/node_modules/pause-stream/package.json b/node_modules/jsftp/node_modules/event-stream/node_modules/pause-stream/package.json
new file mode 100644
index 0000000..cc11408
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/node_modules/pause-stream/package.json
@@ -0,0 +1,45 @@
+{
+ "name": "pause-stream",
+ "version": "0.0.10",
+ "description": "a ThroughStream that strictly buffers all readable events when paused.",
+ "main": "index.js",
+ "directories": {
+ "test": "test"
+ },
+ "devDependencies": {
+ "stream-tester": "0.0.2",
+ "stream-spec": "~0.2.0"
+ },
+ "scripts": {
+ "test": "node test/index.js && node test/pause-end.js"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/dominictarr/pause-stream.git"
+ },
+ "keywords": [
+ "stream",
+ "pipe",
+ "pause",
+ "drain",
+ "buffer"
+ ],
+ "author": {
+ "name": "Dominic Tarr",
+ "email": "dominic.tarr@gmail.com",
+ "url": "dominictarr.com"
+ },
+ "license": [
+ "MIT",
+ "Apache2"
+ ],
+ "dependencies": {
+ "through": "~2.3"
+ },
+ "readme": "# PauseStream\n\nThis is a `Stream` that will strictly buffer when paused.\nConnect it to anything you need buffered.\n\n``` js\n var ps = require('pause-stream')();\n\n badlyBehavedStream.pipe(ps.pause())\n\n aLittleLater(function (err, data) {\n ps.pipe(createAnotherStream(data))\n ps.resume()\n })\n```\n\n`PauseStream` will buffer whenever paused.\nit will buffer when yau have called `pause` manually.\nbut also when it's downstream `dest.write()===false`.\nit will attempt to drain the buffer when you call resume\nor the downstream emits `'drain'`\n\n`PauseStream` is tested using [stream-spec](https://github.com/dominictarr/stream-spec)\nand [stream-tester](https://github.com/dominictarr/stream-tester)\n\nThis is now the default case of \n[through](https://github.com/dominictarr/through)\n\nhttps://github.com/dominictarr/pause-stream/commit/4a6fe3dc2c11091b1efbfde912e0473719ed9cc0\n",
+ "_id": "pause-stream@0.0.10",
+ "dist": {
+ "shasum": "0b28365a705bb18fecd89d4722e11275c109eb66"
+ },
+ "_from": "pause-stream@0.0.10"
+}
diff --git a/node_modules/jsftp/node_modules/event-stream/node_modules/pause-stream/readme.markdown b/node_modules/jsftp/node_modules/event-stream/node_modules/pause-stream/readme.markdown
new file mode 100644
index 0000000..2366939
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/node_modules/pause-stream/readme.markdown
@@ -0,0 +1,29 @@
+# PauseStream
+
+This is a `Stream` that will strictly buffer when paused.
+Connect it to anything you need buffered.
+
+``` js
+ var ps = require('pause-stream')();
+
+ badlyBehavedStream.pipe(ps.pause())
+
+ aLittleLater(function (err, data) {
+ ps.pipe(createAnotherStream(data))
+ ps.resume()
+ })
+```
+
+`PauseStream` will buffer whenever paused.
+it will buffer when yau have called `pause` manually.
+but also when it's downstream `dest.write()===false`.
+it will attempt to drain the buffer when you call resume
+or the downstream emits `'drain'`
+
+`PauseStream` is tested using [stream-spec](https://github.com/dominictarr/stream-spec)
+and [stream-tester](https://github.com/dominictarr/stream-tester)
+
+This is now the default case of
+[through](https://github.com/dominictarr/through)
+
+https://github.com/dominictarr/pause-stream/commit/4a6fe3dc2c11091b1efbfde912e0473719ed9cc0
diff --git a/node_modules/jsftp/node_modules/event-stream/node_modules/pause-stream/test/index.js b/node_modules/jsftp/node_modules/event-stream/node_modules/pause-stream/test/index.js
new file mode 100644
index 0000000..db8778d
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/node_modules/pause-stream/test/index.js
@@ -0,0 +1,17 @@
+var spec = require('stream-spec')
+var tester = require('stream-tester')
+var ps = require('..')()
+
+spec(ps)
+ .through({strict: false})
+ .validateOnExit()
+
+var master = tester.createConsistent
+
+tester.createRandomStream(1000) //1k random numbers
+ .pipe(master = tester.createConsistentStream())
+ .pipe(tester.createUnpauseStream())
+ .pipe(ps)
+ .pipe(tester.createPauseStream())
+ .pipe(master.createSlave())
+
diff --git a/node_modules/jsftp/node_modules/event-stream/node_modules/pause-stream/test/pause-end.js b/node_modules/jsftp/node_modules/event-stream/node_modules/pause-stream/test/pause-end.js
new file mode 100644
index 0000000..a6c27ef
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/node_modules/pause-stream/test/pause-end.js
@@ -0,0 +1,33 @@
+
+var pause = require('..')
+var assert = require('assert')
+
+var ps = pause()
+var read = [], ended = false
+
+ps.on('data', function (i) {
+ read.push(i)
+})
+
+ps.on('end', function () {
+ ended = true
+})
+
+assert.deepEqual(read, [])
+
+ps.write(0)
+ps.write(1)
+ps.write(2)
+
+assert.deepEqual(read, [0, 1, 2])
+
+ps.pause()
+
+assert.deepEqual(read, [0, 1, 2])
+
+ps.end()
+assert.equal(ended, false)
+ps.resume()
+assert.equal(ended, true)
+
+
diff --git a/node_modules/jsftp/node_modules/event-stream/node_modules/split/.npmignore b/node_modules/jsftp/node_modules/event-stream/node_modules/split/.npmignore
new file mode 100644
index 0000000..13abef4
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/node_modules/split/.npmignore
@@ -0,0 +1,3 @@
+node_modules
+node_modules/*
+npm_debug.log
diff --git a/node_modules/jsftp/node_modules/event-stream/node_modules/split/.travis.yml b/node_modules/jsftp/node_modules/event-stream/node_modules/split/.travis.yml
new file mode 100644
index 0000000..dad2273
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/node_modules/split/.travis.yml
@@ -0,0 +1,4 @@
+language: node_js
+node_js:
+ - 0.8
+ - "0.10"
diff --git a/node_modules/jsftp/node_modules/event-stream/node_modules/split/LICENCE b/node_modules/jsftp/node_modules/event-stream/node_modules/split/LICENCE
new file mode 100644
index 0000000..171dd97
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/node_modules/split/LICENCE
@@ -0,0 +1,22 @@
+Copyright (c) 2011 Dominic Tarr
+
+Permission is hereby granted, free of charge,
+to any person obtaining a copy of this software and
+associated documentation files (the "Software"), to
+deal in the Software without restriction, including
+without limitation the rights to use, copy, modify,
+merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom
+the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice
+shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file
diff --git a/node_modules/jsftp/node_modules/event-stream/node_modules/split/examples/pretty.js b/node_modules/jsftp/node_modules/event-stream/node_modules/split/examples/pretty.js
new file mode 100644
index 0000000..2e89131
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/node_modules/split/examples/pretty.js
@@ -0,0 +1,26 @@
+
+var inspect = require('util').inspect
+var es = require('event-stream') //load event-stream
+var split = require('../')
+
+if(!module.parent) {
+ es.pipe( //pipe joins streams together
+ process.openStdin(), //open stdin
+ split(), //split stream to break on newlines
+ es.map(function (data, callback) {//turn this async function into a stream
+ var j
+ try {
+ j = JSON.parse(data) //try to parse input into json
+ } catch (err) {
+ return callback(null, data) //if it fails just pass it anyway
+ }
+ callback(null, inspect(j)) //render it nicely
+ }),
+ process.stdout // pipe it to stdout !
+ )
+ }
+
+// run this
+//
+// curl -sS registry.npmjs.org/event-stream | node pretty.js
+//
diff --git a/node_modules/jsftp/node_modules/event-stream/node_modules/split/index.js b/node_modules/jsftp/node_modules/event-stream/node_modules/split/index.js
new file mode 100644
index 0000000..ca57e0f
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/node_modules/split/index.js
@@ -0,0 +1,59 @@
+//filter will reemit the data if cb(err,pass) pass is truthy
+
+// reduce is more tricky
+// maybe we want to group the reductions or emit progress updates occasionally
+// the most basic reduce just emits one 'data' event after it has recieved 'end'
+
+
+var through = require('through')
+var Decoder = require('string_decoder').StringDecoder
+
+module.exports = split
+
+//TODO pass in a function to map across the lines.
+
+function split (matcher, mapper) {
+ var decoder = new Decoder()
+ var soFar = ''
+ if('function' === typeof matcher)
+ mapper = matcher, matcher = null
+ if (!matcher)
+ matcher = /\r?\n/
+
+ function emit(stream, piece) {
+ if(mapper) {
+ try {
+ piece = mapper(piece)
+ }
+ catch (err) {
+ return stream.emit('error', err)
+ }
+ if('undefined' !== typeof piece)
+ stream.queue(piece)
+ }
+ else
+ stream.queue(piece)
+ }
+
+ function next (stream, buffer) {
+ var pieces = (soFar + buffer).split(matcher)
+ soFar = pieces.pop()
+
+ for (var i = 0; i < pieces.length; i++) {
+ var piece = pieces[i]
+ emit(stream, piece)
+ }
+ }
+
+ return through(function (b) {
+ next(this, decoder.write(b))
+ },
+ function () {
+ if(decoder.end)
+ next(this, decoder.end())
+ if(soFar != null)
+ emit(this, soFar)
+ this.queue(null)
+ })
+}
+
diff --git a/node_modules/jsftp/node_modules/event-stream/node_modules/split/package.json b/node_modules/jsftp/node_modules/event-stream/node_modules/split/package.json
new file mode 100644
index 0000000..55a77ee
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/node_modules/split/package.json
@@ -0,0 +1,38 @@
+{
+ "name": "split",
+ "version": "0.2.10",
+ "description": "split a Text Stream into a Line Stream",
+ "homepage": "http://github.com/dominictarr/split",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/dominictarr/split.git"
+ },
+ "dependencies": {
+ "through": "2"
+ },
+ "devDependencies": {
+ "asynct": "*",
+ "it-is": "1",
+ "ubelt": "~2.9",
+ "stream-spec": "~0.2",
+ "event-stream": "~3.0.2"
+ },
+ "scripts": {
+ "test": "asynct test/"
+ },
+ "author": {
+ "name": "Dominic Tarr",
+ "email": "dominic.tarr@gmail.com",
+ "url": "http://bit.ly/dominictarr"
+ },
+ "optionalDependencies": {},
+ "engines": {
+ "node": "*"
+ },
+ "readme": "# Split (matcher)\n\n[![build status](https://secure.travis-ci.org/dominictarr/split.png)](http://travis-ci.org/dominictarr/split)\n\nBreak up a stream and reassemble it so that each line is a chunk. matcher may be a `String`, or a `RegExp` \n\nExample, read every line in a file ...\n\n``` js\n fs.createReadStream(file)\n .pipe(split())\n .on('data', function (line) {\n //each chunk now is a seperate line!\n })\n\n```\n\n`split` takes the same arguments as `string.split` except it defaults to '/\\r?\\n/' instead of ',', and the optional `limit` paremeter is ignored.\n[String#split](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String/split)\n\n# NDJ - Newline Delimited Json\n\n`split` accepts a function which transforms each line.\n\n``` js\nfs.createReadStream(file)\n .pipe(split(JSON.parse))\n .on('data', function (obj) {\n //each chunk now is a a js object\n })\n .on('error', function (err) {\n //syntax errors will land here\n //note, this ends the stream.\n })\n```\n\n# License\n\nMIT\n",
+ "_id": "split@0.2.10",
+ "dist": {
+ "shasum": "f3df4e839e7f9dc513d5463b1c8ad95d4bf75e85"
+ },
+ "_from": "split@0.2"
+}
diff --git a/node_modules/jsftp/node_modules/event-stream/node_modules/split/readme.markdown b/node_modules/jsftp/node_modules/event-stream/node_modules/split/readme.markdown
new file mode 100644
index 0000000..55b8ba8
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/node_modules/split/readme.markdown
@@ -0,0 +1,39 @@
+# Split (matcher)
+
+[![build status](https://secure.travis-ci.org/dominictarr/split.png)](http://travis-ci.org/dominictarr/split)
+
+Break up a stream and reassemble it so that each line is a chunk. matcher may be a `String`, or a `RegExp`
+
+Example, read every line in a file ...
+
+``` js
+ fs.createReadStream(file)
+ .pipe(split())
+ .on('data', function (line) {
+ //each chunk now is a seperate line!
+ })
+
+```
+
+`split` takes the same arguments as `string.split` except it defaults to '/\r?\n/' instead of ',', and the optional `limit` paremeter is ignored.
+[String#split](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String/split)
+
+# NDJ - Newline Delimited Json
+
+`split` accepts a function which transforms each line.
+
+``` js
+fs.createReadStream(file)
+ .pipe(split(JSON.parse))
+ .on('data', function (obj) {
+ //each chunk now is a a js object
+ })
+ .on('error', function (err) {
+ //syntax errors will land here
+ //note, this ends the stream.
+ })
+```
+
+# License
+
+MIT
diff --git a/node_modules/jsftp/node_modules/event-stream/node_modules/split/test/partitioned_unicode.js b/node_modules/jsftp/node_modules/event-stream/node_modules/split/test/partitioned_unicode.js
new file mode 100644
index 0000000..aff3d5d
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/node_modules/split/test/partitioned_unicode.js
@@ -0,0 +1,34 @@
+var it = require('it-is').style('colour')
+ , split = require('..')
+
+exports ['split data with partitioned unicode character'] = function (test) {
+ var s = split(/,/g)
+ , caughtError = false
+ , rows = []
+
+ s.on('error', function (err) {
+ caughtError = true
+ })
+
+ s.on('data', function (row) { rows.push(row) })
+
+ var x = 'テスト試験今日とても,よい天気で'
+ unicodeData = new Buffer(x);
+
+ // partition of 日
+ piece1 = unicodeData.slice(0, 20);
+ piece2 = unicodeData.slice(20, unicodeData.length);
+
+ s.write(piece1);
+ s.write(piece2);
+
+ s.end()
+
+ it(caughtError).equal(false)
+
+ it(rows).deepEqual(['テスト試験今日とても', 'よい天気で']);
+
+ it(rows).deepEqual(x.split(','))
+
+ test.done()
+}
diff --git a/node_modules/jsftp/node_modules/event-stream/node_modules/split/test/split.asynct.js b/node_modules/jsftp/node_modules/event-stream/node_modules/split/test/split.asynct.js
new file mode 100644
index 0000000..fb15b28
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/node_modules/split/test/split.asynct.js
@@ -0,0 +1,85 @@
+var es = require('event-stream')
+ , it = require('it-is').style('colour')
+ , d = require('ubelt')
+ , split = require('..')
+ , join = require('path').join
+ , fs = require('fs')
+ , Stream = require('stream').Stream
+ , spec = require('stream-spec')
+
+exports ['split() works like String#split'] = function (test) {
+ var readme = join(__filename)
+ , expected = fs.readFileSync(readme, 'utf-8').split('\n')
+ , cs = split()
+ , actual = []
+ , ended = false
+ , x = spec(cs).through()
+
+ var a = new Stream ()
+
+ a.write = function (l) {
+ actual.push(l.trim())
+ }
+ a.end = function () {
+
+ ended = true
+ expected.forEach(function (v,k) {
+ //String.split will append an empty string ''
+ //if the string ends in a split pattern.
+ //es.split doesn't which was breaking this test.
+ //clearly, appending the empty string is correct.
+ //tests are passing though. which is the current job.
+ if(v)
+ it(actual[k]).like(v)
+ })
+ //give the stream time to close
+ process.nextTick(function () {
+ test.done()
+ x.validate()
+ })
+ }
+ a.writable = true
+
+ fs.createReadStream(readme, {flags: 'r'}).pipe(cs)
+ cs.pipe(a)
+
+}
+
+exports ['split() takes mapper function'] = function (test) {
+ var readme = join(__filename)
+ , expected = fs.readFileSync(readme, 'utf-8').split('\n')
+ , cs = split(function (line) { return line.toUpperCase() })
+ , actual = []
+ , ended = false
+ , x = spec(cs).through()
+
+ var a = new Stream ()
+
+ a.write = function (l) {
+ actual.push(l.trim())
+ }
+ a.end = function () {
+
+ ended = true
+ expected.forEach(function (v,k) {
+ //String.split will append an empty string ''
+ //if the string ends in a split pattern.
+ //es.split doesn't which was breaking this test.
+ //clearly, appending the empty string is correct.
+ //tests are passing though. which is the current job.
+ if(v)
+ it(actual[k]).equal(v.trim().toUpperCase())
+ })
+ //give the stream time to close
+ process.nextTick(function () {
+ test.done()
+ x.validate()
+ })
+ }
+ a.writable = true
+
+ fs.createReadStream(readme, {flags: 'r'}).pipe(cs)
+ cs.pipe(a)
+
+}
+
diff --git a/node_modules/jsftp/node_modules/event-stream/node_modules/split/test/try_catch.asynct.js b/node_modules/jsftp/node_modules/event-stream/node_modules/split/test/try_catch.asynct.js
new file mode 100644
index 0000000..39e49f7
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/node_modules/split/test/try_catch.asynct.js
@@ -0,0 +1,51 @@
+var it = require('it-is').style('colour')
+ , split = require('..')
+
+exports ['emit mapper exceptions as error events'] = function (test) {
+ var s = split(JSON.parse)
+ , caughtError = false
+ , rows = []
+
+ s.on('error', function (err) {
+ caughtError = true
+ })
+
+ s.on('data', function (row) { rows.push(row) })
+
+ s.write('{"a":1}\n{"')
+ it(caughtError).equal(false)
+ it(rows).deepEqual([ { a: 1 } ])
+
+ s.write('b":2}\n{"c":}\n')
+ it(caughtError).equal(true)
+ it(rows).deepEqual([ { a: 1 }, { b: 2 } ])
+
+ s.end()
+ test.done()
+}
+
+exports ['mapper error events on trailing chunks'] = function (test) {
+ var s = split(JSON.parse)
+ , caughtError = false
+ , rows = []
+
+ s.on('error', function (err) {
+ caughtError = true
+ })
+
+ s.on('data', function (row) { rows.push(row) })
+
+ s.write('{"a":1}\n{"')
+ it(caughtError).equal(false)
+ it(rows).deepEqual([ { a: 1 } ])
+
+ s.write('b":2}\n{"c":}')
+ it(caughtError).equal(false)
+ it(rows).deepEqual([ { a: 1 }, { b: 2 } ])
+
+ s.end()
+ it(caughtError).equal(true)
+ it(rows).deepEqual([ { a: 1 }, { b: 2 } ])
+
+ test.done()
+}
diff --git a/node_modules/jsftp/node_modules/event-stream/node_modules/stream-combiner/.npmignore b/node_modules/jsftp/node_modules/event-stream/node_modules/stream-combiner/.npmignore
new file mode 100644
index 0000000..13abef4
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/node_modules/stream-combiner/.npmignore
@@ -0,0 +1,3 @@
+node_modules
+node_modules/*
+npm_debug.log
diff --git a/node_modules/jsftp/node_modules/event-stream/node_modules/stream-combiner/.travis.yml b/node_modules/jsftp/node_modules/event-stream/node_modules/stream-combiner/.travis.yml
new file mode 100644
index 0000000..895dbd3
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/node_modules/stream-combiner/.travis.yml
@@ -0,0 +1,4 @@
+language: node_js
+node_js:
+ - 0.6
+ - 0.8
diff --git a/node_modules/jsftp/node_modules/event-stream/node_modules/stream-combiner/LICENSE b/node_modules/jsftp/node_modules/event-stream/node_modules/stream-combiner/LICENSE
new file mode 100644
index 0000000..6d03581
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/node_modules/stream-combiner/LICENSE
@@ -0,0 +1,22 @@
+Copyright (c) 2012 'Dominic Tarr'
+
+Permission is hereby granted, free of charge,
+to any person obtaining a copy of this software and
+associated documentation files (the "Software"), to
+deal in the Software without restriction, including
+without limitation the rights to use, copy, modify,
+merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom
+the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice
+shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/jsftp/node_modules/event-stream/node_modules/stream-combiner/README.md b/node_modules/jsftp/node_modules/event-stream/node_modules/stream-combiner/README.md
new file mode 100644
index 0000000..d0c129c
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/node_modules/stream-combiner/README.md
@@ -0,0 +1,29 @@
+# stream-combiner
+
+
+
+## pipeline (stream1,...,streamN)
+
+Turn a pipeline into a single stream. `pipeline` returns a stream that writes to the first stream
+and reads from the last stream.
+
+Listening for 'error' will recieve errors from all streams inside the pipe.
+
+> `connect` is an alias for `pipeline`.
+
+``` js
+
+ es.pipeline( //connect streams together with `pipe`
+ process.openStdin(), //open stdin
+ es.split(), //split stream to break on newlines
+ es.map(function (data, callback) {//turn this async function into a stream
+ callback(null
+ , inspect(JSON.parse(data))) //render it nicely
+ }),
+ process.stdout // pipe it to stdout !
+ )
+```
+
+## License
+
+MIT
diff --git a/node_modules/jsftp/node_modules/event-stream/node_modules/stream-combiner/index.js b/node_modules/jsftp/node_modules/event-stream/node_modules/stream-combiner/index.js
new file mode 100644
index 0000000..99cf5b6
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/node_modules/stream-combiner/index.js
@@ -0,0 +1,39 @@
+var duplexer = require('duplexer')
+
+module.exports = function () {
+
+ var streams = [].slice.call(arguments)
+ , first = streams[0]
+ , last = streams[streams.length - 1]
+ , thepipe = duplexer(first, last)
+
+ if(streams.length == 1)
+ return streams[0]
+ else if (!streams.length)
+ throw new Error('connect called with empty args')
+
+ //pipe all the streams together
+
+ function recurse (streams) {
+ if(streams.length < 2)
+ return
+ streams[0].pipe(streams[1])
+ recurse(streams.slice(1))
+ }
+
+ recurse(streams)
+
+ function onerror () {
+ var args = [].slice.call(arguments)
+ args.unshift('error')
+ thepipe.emit.apply(thepipe, args)
+ }
+
+ //es.duplex already reemits the error from the first and last stream.
+ //add a listener for the inner streams in the pipeline.
+ for(var i = 1; i < streams.length - 1; i ++)
+ streams[i].on('error', onerror)
+
+ return thepipe
+}
+
diff --git a/node_modules/jsftp/node_modules/event-stream/node_modules/stream-combiner/node_modules/duplexer/.npmignore b/node_modules/jsftp/node_modules/event-stream/node_modules/stream-combiner/node_modules/duplexer/.npmignore
new file mode 100644
index 0000000..062c11e
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/node_modules/stream-combiner/node_modules/duplexer/.npmignore
@@ -0,0 +1,3 @@
+node_modules
+*.log
+*.err
\ No newline at end of file
diff --git a/node_modules/jsftp/node_modules/event-stream/node_modules/stream-combiner/node_modules/duplexer/.travis.yml b/node_modules/jsftp/node_modules/event-stream/node_modules/stream-combiner/node_modules/duplexer/.travis.yml
new file mode 100644
index 0000000..c2ba3f9
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/node_modules/stream-combiner/node_modules/duplexer/.travis.yml
@@ -0,0 +1,3 @@
+language: node_js
+node_js:
+ - 0.8
\ No newline at end of file
diff --git a/node_modules/jsftp/node_modules/event-stream/node_modules/stream-combiner/node_modules/duplexer/LICENCE b/node_modules/jsftp/node_modules/event-stream/node_modules/stream-combiner/node_modules/duplexer/LICENCE
new file mode 100644
index 0000000..a23e08a
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/node_modules/stream-combiner/node_modules/duplexer/LICENCE
@@ -0,0 +1,19 @@
+Copyright (c) 2012 Raynos.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
\ No newline at end of file
diff --git a/node_modules/jsftp/node_modules/event-stream/node_modules/stream-combiner/node_modules/duplexer/Makefile b/node_modules/jsftp/node_modules/event-stream/node_modules/stream-combiner/node_modules/duplexer/Makefile
new file mode 100644
index 0000000..1f8985d
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/node_modules/stream-combiner/node_modules/duplexer/Makefile
@@ -0,0 +1,4 @@
+test:
+ node test.js
+
+.PHONY: test
\ No newline at end of file
diff --git a/node_modules/jsftp/node_modules/event-stream/node_modules/stream-combiner/node_modules/duplexer/README.md b/node_modules/jsftp/node_modules/event-stream/node_modules/stream-combiner/node_modules/duplexer/README.md
new file mode 100644
index 0000000..a24cecb
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/node_modules/stream-combiner/node_modules/duplexer/README.md
@@ -0,0 +1,36 @@
+# duplexer [![build status][1]][2]
+
+Creates a duplex stream
+
+Taken from [event-stream][3]
+
+## duplex (writeStream, readStream)
+
+Takes a writable stream and a readable stream and makes them appear as a readable writable stream.
+
+It is assumed that the two streams are connected to each other in some way.
+
+## Example
+
+ var grep = cp.exec('grep Stream')
+
+ duplex(grep.stdin, grep.stdout)
+
+## Installation
+
+`npm install duplexer`
+
+## Tests
+
+`make test`
+
+## Contributors
+
+ - Dominictarr
+ - Raynos
+
+## MIT Licenced
+
+ [1]: https://secure.travis-ci.org/Raynos/duplexer.png
+ [2]: http://travis-ci.org/Raynos/duplexer
+ [3]: https://github.com/dominictarr/event-stream#duplex-writestream-readstream
\ No newline at end of file
diff --git a/node_modules/jsftp/node_modules/event-stream/node_modules/stream-combiner/node_modules/duplexer/index.js b/node_modules/jsftp/node_modules/event-stream/node_modules/stream-combiner/node_modules/duplexer/index.js
new file mode 100644
index 0000000..fee581d
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/node_modules/stream-combiner/node_modules/duplexer/index.js
@@ -0,0 +1,87 @@
+var Stream = require("stream")
+ , writeMethods = ["write", "end", "destroy"]
+ , readMethods = ["resume", "pause"]
+ , readEvents = ["data", "close"]
+ , slice = Array.prototype.slice
+
+module.exports = duplex
+
+function duplex(writer, reader) {
+ var stream = new Stream()
+ , ended = false
+
+ Object.defineProperties(stream, {
+ writable: {
+ get: getWritable
+ }
+ , readable: {
+ get: getReadable
+ }
+ })
+
+ writeMethods.forEach(proxyWriter)
+
+ readMethods.forEach(proxyReader)
+
+ readEvents.forEach(proxyStream)
+
+ reader.on("end", handleEnd)
+
+ writer.on("error", reemit)
+ reader.on("error", reemit)
+
+ return stream
+
+ function getWritable() {
+ return writer.writable
+ }
+
+ function getReadable() {
+ return reader.readable
+ }
+
+ function proxyWriter(methodName) {
+ stream[methodName] = method
+
+ function method() {
+ return writer[methodName].apply(writer, arguments)
+ }
+ }
+
+ function proxyReader(methodName) {
+ stream[methodName] = method
+
+ function method() {
+ stream.emit(methodName)
+ var func = reader[methodName]
+ if (func) {
+ return func.apply(reader, arguments)
+ }
+ reader.emit(methodName)
+ }
+ }
+
+ function proxyStream(methodName) {
+ reader.on(methodName, reemit)
+
+ function reemit() {
+ var args = slice.call(arguments)
+ args.unshift(methodName)
+ stream.emit.apply(stream, args)
+ }
+ }
+
+ function handleEnd() {
+ if (ended) {
+ return
+ }
+ ended = true
+ var args = slice.call(arguments)
+ args.unshift("end")
+ stream.emit.apply(stream, args)
+ }
+
+ function reemit(err) {
+ stream.emit("error", err)
+ }
+}
\ No newline at end of file
diff --git a/node_modules/jsftp/node_modules/event-stream/node_modules/stream-combiner/node_modules/duplexer/package.json b/node_modules/jsftp/node_modules/event-stream/node_modules/stream-combiner/node_modules/duplexer/package.json
new file mode 100644
index 0000000..c04e5f6
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/node_modules/stream-combiner/node_modules/duplexer/package.json
@@ -0,0 +1,44 @@
+{
+ "name": "duplexer",
+ "version": "0.0.2",
+ "description": "Creates a duplex stream",
+ "keywords": [],
+ "author": {
+ "name": "Raynos",
+ "email": "raynos2@gmail.com"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/Raynos/duplexer.git"
+ },
+ "main": "index",
+ "homepage": "https://github.com/Raynos/duplexer",
+ "contributors": [
+ {
+ "name": "Jake Verbaten"
+ }
+ ],
+ "bugs": {
+ "url": "https://github.com/Raynos/duplexer/issues",
+ "email": "raynos2@gmail.com"
+ },
+ "dependencies": {},
+ "devDependencies": {
+ "through": "~0.1.4"
+ },
+ "licenses": [
+ {
+ "type": "MIT",
+ "url": "http://github.com/Raynos/duplexer/raw/master/LICENSE"
+ }
+ ],
+ "scripts": {
+ "test": "make test"
+ },
+ "readme": "# duplexer [![build status][1]][2]\n\nCreates a duplex stream\n\nTaken from [event-stream][3]\n\n## duplex (writeStream, readStream)\n\nTakes a writable stream and a readable stream and makes them appear as a readable writable stream.\n\nIt is assumed that the two streams are connected to each other in some way.\n\n## Example\n\n var grep = cp.exec('grep Stream')\n\n duplex(grep.stdin, grep.stdout)\n\n## Installation\n\n`npm install duplexer`\n\n## Tests\n\n`make test`\n\n## Contributors\n\n - Dominictarr\n - Raynos\n\n## MIT Licenced\n\n [1]: https://secure.travis-ci.org/Raynos/duplexer.png\n [2]: http://travis-ci.org/Raynos/duplexer\n [3]: https://github.com/dominictarr/event-stream#duplex-writestream-readstream",
+ "_id": "duplexer@0.0.2",
+ "dist": {
+ "shasum": "21b2a2e78861eea18bb080cb9491cbcd193ead08"
+ },
+ "_from": "duplexer@0.0.2"
+}
diff --git a/node_modules/jsftp/node_modules/event-stream/node_modules/stream-combiner/node_modules/duplexer/test.js b/node_modules/jsftp/node_modules/event-stream/node_modules/stream-combiner/node_modules/duplexer/test.js
new file mode 100644
index 0000000..e06a864
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/node_modules/stream-combiner/node_modules/duplexer/test.js
@@ -0,0 +1,27 @@
+var duplex = require("./index")
+ , assert = require("assert")
+ , through = require("through")
+
+var readable = through()
+ , writable = through(write)
+ , written = 0
+ , data = 0
+
+var stream = duplex(writable, readable)
+
+function write() {
+ written++
+}
+
+stream.on("data", ondata)
+
+function ondata() {
+ data++
+}
+
+stream.write()
+readable.emit("data")
+
+assert.equal(written, 1)
+assert.equal(data, 1)
+console.log("DONE")
\ No newline at end of file
diff --git a/node_modules/jsftp/node_modules/event-stream/node_modules/stream-combiner/package.json b/node_modules/jsftp/node_modules/event-stream/node_modules/stream-combiner/package.json
new file mode 100644
index 0000000..4b60b98
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/node_modules/stream-combiner/package.json
@@ -0,0 +1,32 @@
+{
+ "name": "stream-combiner",
+ "version": "0.0.0",
+ "homepage": "https://github.com/dominictarr/stream-combiner",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/dominictarr/stream-combiner.git"
+ },
+ "dependencies": {
+ "duplexer": "0.0.2"
+ },
+ "devDependencies": {
+ "tape": "0.0.4",
+ "event-stream": "~3.0.7"
+ },
+ "scripts": {
+ "test": "set -e; for t in test/*.js; do node $t; done"
+ },
+ "author": {
+ "name": "'Dominic Tarr'",
+ "email": "dominic.tarr@gmail.com",
+ "url": "http://dominictarr.com"
+ },
+ "license": "MIT",
+ "readme": "# stream-combiner\n\n\n\n## pipeline (stream1,...,streamN)\n\nTurn a pipeline into a single stream. `pipeline` returns a stream that writes to the first stream\nand reads from the last stream. \n\nListening for 'error' will recieve errors from all streams inside the pipe.\n\n> `connect` is an alias for `pipeline`.\n\n``` js\n\n es.pipeline( //connect streams together with `pipe`\n process.openStdin(), //open stdin\n es.split(), //split stream to break on newlines\n es.map(function (data, callback) {//turn this async function into a stream\n callback(null\n , inspect(JSON.parse(data))) //render it nicely\n }),\n process.stdout // pipe it to stdout !\n )\n```\n\n## License\n\nMIT\n",
+ "_id": "stream-combiner@0.0.0",
+ "description": "",
+ "dist": {
+ "shasum": "e0b7200a986c630eef402100cef434714b4db89c"
+ },
+ "_from": "stream-combiner@0.0.0"
+}
diff --git a/node_modules/jsftp/node_modules/event-stream/node_modules/stream-combiner/test/index.js b/node_modules/jsftp/node_modules/event-stream/node_modules/stream-combiner/test/index.js
new file mode 100644
index 0000000..d17ddad
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/node_modules/stream-combiner/test/index.js
@@ -0,0 +1,52 @@
+var es = require('event-stream')
+var combine = require('..')
+var test = require('tape')
+
+test('do not duplicate errors', function (test) {
+
+ var errors = 0;
+ var pipe = combine(
+ es.through(function(data) {
+ return this.emit('data', data);
+ }),
+ es.through(function(data) {
+ return this.emit('error', new Error(data));
+ })
+ )
+
+ pipe.on('error', function(err) {
+ errors++
+ test.ok(errors, 'expected error count')
+ process.nextTick(function () {
+ return test.end();
+ })
+ })
+
+ return pipe.write('meh');
+})
+
+test('3 pipe do not duplicate errors', function (test) {
+
+ var errors = 0;
+ var pipe = combine(
+ es.through(function(data) {
+ return this.emit('data', data);
+ }),
+ es.through(function(data) {
+ return this.emit('error', new Error(data));
+ }),
+ es.through()
+ )
+
+ pipe.on('error', function(err) {
+ errors++
+ test.ok(errors, 'expected error count')
+ process.nextTick(function () {
+ return test.end();
+ })
+ })
+
+ return pipe.write('meh');
+
+})
+
diff --git a/node_modules/jsftp/node_modules/event-stream/node_modules/through/.travis.yml b/node_modules/jsftp/node_modules/event-stream/node_modules/through/.travis.yml
new file mode 100644
index 0000000..c693a93
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/node_modules/through/.travis.yml
@@ -0,0 +1,5 @@
+language: node_js
+node_js:
+ - 0.6
+ - 0.8
+ - "0.10"
diff --git a/node_modules/jsftp/node_modules/event-stream/node_modules/through/LICENSE.APACHE2 b/node_modules/jsftp/node_modules/event-stream/node_modules/through/LICENSE.APACHE2
new file mode 100644
index 0000000..6366c04
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/node_modules/through/LICENSE.APACHE2
@@ -0,0 +1,15 @@
+Apache License, Version 2.0
+
+Copyright (c) 2011 Dominic Tarr
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
diff --git a/node_modules/jsftp/node_modules/event-stream/node_modules/through/LICENSE.MIT b/node_modules/jsftp/node_modules/event-stream/node_modules/through/LICENSE.MIT
new file mode 100644
index 0000000..6eafbd7
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/node_modules/through/LICENSE.MIT
@@ -0,0 +1,24 @@
+The MIT License
+
+Copyright (c) 2011 Dominic Tarr
+
+Permission is hereby granted, free of charge,
+to any person obtaining a copy of this software and
+associated documentation files (the "Software"), to
+deal in the Software without restriction, including
+without limitation the rights to use, copy, modify,
+merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom
+the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice
+shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/jsftp/node_modules/event-stream/node_modules/through/index.js b/node_modules/jsftp/node_modules/event-stream/node_modules/through/index.js
new file mode 100644
index 0000000..7b935bf
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/node_modules/through/index.js
@@ -0,0 +1,108 @@
+var Stream = require('stream')
+
+// through
+//
+// a stream that does nothing but re-emit the input.
+// useful for aggregating a series of changing but not ending streams into one stream)
+
+exports = module.exports = through
+through.through = through
+
+//create a readable writable stream.
+
+function through (write, end, opts) {
+ write = write || function (data) { this.queue(data) }
+ end = end || function () { this.queue(null) }
+
+ var ended = false, destroyed = false, buffer = [], _ended = false
+ var stream = new Stream()
+ stream.readable = stream.writable = true
+ stream.paused = false
+
+// stream.autoPause = !(opts && opts.autoPause === false)
+ stream.autoDestroy = !(opts && opts.autoDestroy === false)
+
+ stream.write = function (data) {
+ write.call(this, data)
+ return !stream.paused
+ }
+
+ function drain() {
+ while(buffer.length && !stream.paused) {
+ var data = buffer.shift()
+ if(null === data)
+ return stream.emit('end')
+ else
+ stream.emit('data', data)
+ }
+ }
+
+ stream.queue = stream.push = function (data) {
+// console.error(ended)
+ if(_ended) return stream
+ if(data == null) _ended = true
+ buffer.push(data)
+ drain()
+ return stream
+ }
+
+ //this will be registered as the first 'end' listener
+ //must call destroy next tick, to make sure we're after any
+ //stream piped from here.
+ //this is only a problem if end is not emitted synchronously.
+ //a nicer way to do this is to make sure this is the last listener for 'end'
+
+ stream.on('end', function () {
+ stream.readable = false
+ if(!stream.writable && stream.autoDestroy)
+ process.nextTick(function () {
+ stream.destroy()
+ })
+ })
+
+ function _end () {
+ stream.writable = false
+ end.call(stream)
+ if(!stream.readable && stream.autoDestroy)
+ stream.destroy()
+ }
+
+ stream.end = function (data) {
+ if(ended) return
+ ended = true
+ if(arguments.length) stream.write(data)
+ _end() // will emit or queue
+ return stream
+ }
+
+ stream.destroy = function () {
+ if(destroyed) return
+ destroyed = true
+ ended = true
+ buffer.length = 0
+ stream.writable = stream.readable = false
+ stream.emit('close')
+ return stream
+ }
+
+ stream.pause = function () {
+ if(stream.paused) return
+ stream.paused = true
+ return stream
+ }
+
+ stream.resume = function () {
+ if(stream.paused) {
+ stream.paused = false
+ stream.emit('resume')
+ }
+ drain()
+ //may have become paused again,
+ //as drain emits 'data'.
+ if(!stream.paused)
+ stream.emit('drain')
+ return stream
+ }
+ return stream
+}
+
diff --git a/node_modules/jsftp/node_modules/event-stream/node_modules/through/package.json b/node_modules/jsftp/node_modules/event-stream/node_modules/through/package.json
new file mode 100644
index 0000000..833c49e
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/node_modules/through/package.json
@@ -0,0 +1,45 @@
+{
+ "name": "through",
+ "version": "2.3.4",
+ "description": "simplified stream contsruction",
+ "main": "index.js",
+ "scripts": {
+ "test": "set -e; for t in test/*.js; do node $t; done"
+ },
+ "devDependencies": {
+ "stream-spec": "~0.3.5",
+ "tape": "~0.2.2"
+ },
+ "keywords": [
+ "stream",
+ "streams",
+ "user-streams",
+ "pipe"
+ ],
+ "author": {
+ "name": "Dominic Tarr",
+ "email": "dominic.tarr@gmail.com",
+ "url": "dominictarr.com"
+ },
+ "license": "MIT",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/dominictarr/through.git"
+ },
+ "homepage": "http://github.com/dominictarr/through",
+ "testling": {
+ "browsers": [
+ "ie/8..latest",
+ "ff/15..latest",
+ "chrome/20..latest",
+ "safari/5.1..latest"
+ ],
+ "files": "test/*.js"
+ },
+ "readme": "#through\n\n[![build status](https://secure.travis-ci.org/dominictarr/through.png)](http://travis-ci.org/dominictarr/through)\n\nEasy way to create a `Stream` that is both `readable` and `writable`. \n\n* Pass in optional `write` and `end` methods.\n* `through` takes care of pause/resume logic if you use `this.queue(data)` instead of `this.emit('data', data)`.\n* Use `this.pause()` and `this.resume()` to manage flow.\n* Check `this.paused` to see current flow state. (`write` always returns `!this.paused`).\n\nThis function is the basis for most of the synchronous streams in \n[event-stream](http://github.com/dominictarr/event-stream).\n\n``` js\nvar through = require('through')\n\nthrough(function write(data) {\n this.queue(data) //data *must* not be null\n },\n function end () { //optional\n this.queue(null)\n })\n```\n\nOr, can also be used _without_ buffering on pause, use `this.emit('data', data)`,\nand this.emit('end')\n\n``` js\nvar through = require('through')\n\nthrough(function write(data) {\n this.emit('data', data)\n //this.pause() \n },\n function end () { //optional\n this.emit('end')\n })\n```\n\n## Extended Options\n\nYou will probably not need these 99% of the time.\n\n### autoDestroy=false\n\nBy default, `through` emits close when the writable\nand readable side of the stream has ended.\nIf that is not desired, set `autoDestroy=false`.\n\n``` js\nvar through = require('through')\n\n//like this\nvar ts = through(write, end, {autoDestroy: false})\n//or like this\nvar ts = through(write, end)\nts.autoDestroy = false\n```\n\n## License\n\nMIT / Apache2\n",
+ "_id": "through@2.3.4",
+ "dist": {
+ "shasum": "b0b7e25d5785ed1c45add69ad718a3ab3bc1f81a"
+ },
+ "_from": "through@~2.3.1"
+}
diff --git a/node_modules/jsftp/node_modules/event-stream/node_modules/through/readme.markdown b/node_modules/jsftp/node_modules/event-stream/node_modules/through/readme.markdown
new file mode 100644
index 0000000..b20bc9a
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/node_modules/through/readme.markdown
@@ -0,0 +1,63 @@
+#through
+
+[![build status](https://secure.travis-ci.org/dominictarr/through.png)](http://travis-ci.org/dominictarr/through)
+
+Easy way to create a `Stream` that is both `readable` and `writable`.
+
+* Pass in optional `write` and `end` methods.
+* `through` takes care of pause/resume logic if you use `this.queue(data)` instead of `this.emit('data', data)`.
+* Use `this.pause()` and `this.resume()` to manage flow.
+* Check `this.paused` to see current flow state. (`write` always returns `!this.paused`).
+
+This function is the basis for most of the synchronous streams in
+[event-stream](http://github.com/dominictarr/event-stream).
+
+``` js
+var through = require('through')
+
+through(function write(data) {
+ this.queue(data) //data *must* not be null
+ },
+ function end () { //optional
+ this.queue(null)
+ })
+```
+
+Or, can also be used _without_ buffering on pause, use `this.emit('data', data)`,
+and this.emit('end')
+
+``` js
+var through = require('through')
+
+through(function write(data) {
+ this.emit('data', data)
+ //this.pause()
+ },
+ function end () { //optional
+ this.emit('end')
+ })
+```
+
+## Extended Options
+
+You will probably not need these 99% of the time.
+
+### autoDestroy=false
+
+By default, `through` emits close when the writable
+and readable side of the stream has ended.
+If that is not desired, set `autoDestroy=false`.
+
+``` js
+var through = require('through')
+
+//like this
+var ts = through(write, end, {autoDestroy: false})
+//or like this
+var ts = through(write, end)
+ts.autoDestroy = false
+```
+
+## License
+
+MIT / Apache2
diff --git a/node_modules/jsftp/node_modules/event-stream/node_modules/through/test/auto-destroy.js b/node_modules/jsftp/node_modules/event-stream/node_modules/through/test/auto-destroy.js
new file mode 100644
index 0000000..9a8fd00
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/node_modules/through/test/auto-destroy.js
@@ -0,0 +1,30 @@
+var test = require('tape')
+var through = require('../')
+
+// must emit end before close.
+
+test('end before close', function (assert) {
+ var ts = through()
+ ts.autoDestroy = false
+ var ended = false, closed = false
+
+ ts.on('end', function () {
+ assert.ok(!closed)
+ ended = true
+ })
+ ts.on('close', function () {
+ assert.ok(ended)
+ closed = true
+ })
+
+ ts.write(1)
+ ts.write(2)
+ ts.write(3)
+ ts.end()
+ assert.ok(ended)
+ assert.notOk(closed)
+ ts.destroy()
+ assert.ok(closed)
+ assert.end()
+})
+
diff --git a/node_modules/jsftp/node_modules/event-stream/node_modules/through/test/buffering.js b/node_modules/jsftp/node_modules/event-stream/node_modules/through/test/buffering.js
new file mode 100644
index 0000000..b0084bf
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/node_modules/through/test/buffering.js
@@ -0,0 +1,71 @@
+var test = require('tape')
+var through = require('../')
+
+// must emit end before close.
+
+test('buffering', function(assert) {
+ var ts = through(function (data) {
+ this.queue(data)
+ }, function () {
+ this.queue(null)
+ })
+
+ var ended = false, actual = []
+
+ ts.on('data', actual.push.bind(actual))
+ ts.on('end', function () {
+ ended = true
+ })
+
+ ts.write(1)
+ ts.write(2)
+ ts.write(3)
+ assert.deepEqual(actual, [1, 2, 3])
+ ts.pause()
+ ts.write(4)
+ ts.write(5)
+ ts.write(6)
+ assert.deepEqual(actual, [1, 2, 3])
+ ts.resume()
+ assert.deepEqual(actual, [1, 2, 3, 4, 5, 6])
+ ts.pause()
+ ts.end()
+ assert.ok(!ended)
+ ts.resume()
+ assert.ok(ended)
+ assert.end()
+})
+
+test('buffering has data in queue, when ends', function (assert) {
+
+ /*
+ * If stream ends while paused with data in the queue,
+ * stream should still emit end after all data is written
+ * on resume.
+ */
+
+ var ts = through(function (data) {
+ this.queue(data)
+ }, function () {
+ this.queue(null)
+ })
+
+ var ended = false, actual = []
+
+ ts.on('data', actual.push.bind(actual))
+ ts.on('end', function () {
+ ended = true
+ })
+
+ ts.pause()
+ ts.write(1)
+ ts.write(2)
+ ts.write(3)
+ ts.end()
+ assert.deepEqual(actual, [], 'no data written yet, still paused')
+ assert.ok(!ended, 'end not emitted yet, still paused')
+ ts.resume()
+ assert.deepEqual(actual, [1, 2, 3], 'resumed, all data should be delivered')
+ assert.ok(ended, 'end should be emitted once all data was delivered')
+ assert.end();
+})
diff --git a/node_modules/jsftp/node_modules/event-stream/node_modules/through/test/end.js b/node_modules/jsftp/node_modules/event-stream/node_modules/through/test/end.js
new file mode 100644
index 0000000..fa113f5
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/node_modules/through/test/end.js
@@ -0,0 +1,45 @@
+var test = require('tape')
+var through = require('../')
+
+// must emit end before close.
+
+test('end before close', function (assert) {
+ var ts = through()
+ var ended = false, closed = false
+
+ ts.on('end', function () {
+ assert.ok(!closed)
+ ended = true
+ })
+ ts.on('close', function () {
+ assert.ok(ended)
+ closed = true
+ })
+
+ ts.write(1)
+ ts.write(2)
+ ts.write(3)
+ ts.end()
+ assert.ok(ended)
+ assert.ok(closed)
+ assert.end()
+})
+
+test('end only once', function (t) {
+
+ var ts = through()
+ var ended = false, closed = false
+
+ ts.on('end', function () {
+ t.equal(ended, false)
+ ended = true
+ })
+
+ ts.queue(null)
+ ts.queue(null)
+ ts.queue(null)
+
+ ts.resume()
+
+ t.end()
+})
diff --git a/node_modules/jsftp/node_modules/event-stream/node_modules/through/test/index.js b/node_modules/jsftp/node_modules/event-stream/node_modules/through/test/index.js
new file mode 100644
index 0000000..33e33f9
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/node_modules/through/test/index.js
@@ -0,0 +1,114 @@
+
+var test = require('tape')
+var spec = require('stream-spec')
+var through = require('../')
+
+/*
+ I'm using these two functions, and not streams and pipe
+ so there is less to break. if this test fails it must be
+ the implementation of _through_
+*/
+
+function write(array, stream) {
+ array = array.slice()
+ function next() {
+ while(array.length)
+ if(stream.write(array.shift()) === false)
+ return stream.once('drain', next)
+
+ stream.end()
+ }
+
+ next()
+}
+
+function read(stream, callback) {
+ var actual = []
+ stream.on('data', function (data) {
+ actual.push(data)
+ })
+ stream.once('end', function () {
+ callback(null, actual)
+ })
+ stream.once('error', function (err) {
+ callback(err)
+ })
+}
+
+test('simple defaults', function(assert) {
+
+ var l = 1000
+ , expected = []
+
+ while(l--) expected.push(l * Math.random())
+
+ var t = through()
+ spec(t)
+ .through()
+ .pausable()
+ .validateOnExit()
+
+ read(t, function (err, actual) {
+ assert.ifError(err)
+ assert.deepEqual(actual, expected)
+ assert.end()
+ })
+
+ write(expected, t)
+});
+
+test('simple functions', function(assert) {
+
+ var l = 1000
+ , expected = []
+
+ while(l--) expected.push(l * Math.random())
+
+ var t = through(function (data) {
+ this.emit('data', data*2)
+ })
+ spec(t)
+ .through()
+ .pausable()
+ .validateOnExit()
+
+ read(t, function (err, actual) {
+ assert.ifError(err)
+ assert.deepEqual(actual, expected.map(function (data) {
+ return data*2
+ }))
+ assert.end()
+ })
+
+ write(expected, t)
+})
+
+test('pauses', function(assert) {
+
+ var l = 1000
+ , expected = []
+
+ while(l--) expected.push(l) //Math.random())
+
+ var t = through()
+ spec(t)
+ .through()
+ .pausable()
+ .validateOnExit()
+
+ t.on('data', function () {
+ if(Math.random() > 0.1) return
+ t.pause()
+ process.nextTick(function () {
+ t.resume()
+ })
+ })
+
+ read(t, function (err, actual) {
+ assert.ifError(err)
+ assert.deepEqual(actual, expected)
+ assert.end()
+ })
+
+ write(expected, t)
+})
diff --git a/node_modules/jsftp/node_modules/event-stream/package.json b/node_modules/jsftp/node_modules/event-stream/package.json
new file mode 100644
index 0000000..40c8504
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/package.json
@@ -0,0 +1,62 @@
+{
+ "name": "event-stream",
+ "version": "3.0.16",
+ "description": "construct pipes of streams of events",
+ "homepage": "http://github.com/dominictarr/event-stream",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/dominictarr/event-stream.git"
+ },
+ "dependencies": {
+ "through": "~2.3.1",
+ "duplexer": "~0.0.2",
+ "from": "~0",
+ "map-stream": "0.0.2",
+ "pause-stream": "0.0.10",
+ "split": "0.2",
+ "stream-combiner": "0.0.0"
+ },
+ "devDependencies": {
+ "asynct": "*",
+ "it-is": "1",
+ "ubelt": "~2.9",
+ "stream-spec": "~0.2",
+ "tape": "~0.1.5"
+ },
+ "scripts": {
+ "test": "asynct test/",
+ "test_tap": "set -e; for t in test/*.js; do node $t; done"
+ },
+ "testling": {
+ "files": "test/*.js",
+ "browsers": {
+ "ie": [
+ 8,
+ 9
+ ],
+ "firefox": [
+ 13
+ ],
+ "chrome": [
+ 20
+ ],
+ "safari": [
+ 5.1
+ ],
+ "opera": [
+ 12
+ ]
+ }
+ },
+ "author": {
+ "name": "Dominic Tarr",
+ "email": "dominic.tarr@gmail.com",
+ "url": "http://bit.ly/dominictarr"
+ },
+ "readme": "# EventStream\n\n\n\n[![browser status](http://ci.testling.com/dominictarr/event-stream.png)]\n(http://ci.testling.com/dominictarr/event-stream)\n\n[Streams](http://nodejs.org/api/strems.html \"Stream\") are node's best and most misunderstood idea, and \n_EventStream_ is a toolkit to make creating and working with streams easy. \n\nNormally, streams are only used of IO, \nbut in event stream we send all kinds of objects down the pipe. \nIf your application's input and output are streams, \nshouldn't the throughput be a stream too? \n\nThe *EventStream* functions resemble the array functions, \nbecause Streams are like Arrays, but laid out in time, rather than in memory. \n\nAll the `event-stream` functions return instances of `Stream`.\n\n`event-stream` creates \n[0.8 streams](https://github.com/joyent/node/blob/v0.8/doc/api/stream.markdown)\n, which are compatible with [0.10 streams](http://nodejs.org/api/stream.html \"Stream\")\n\n>NOTE: I shall use the term \"through stream\" to refer to a stream that is writable and readable. \n\n###[simple example](https://github.com/dominictarr/event-stream/blob/master/examples/pretty.js):\n\n``` js\n\n//pretty.js\n\nif(!module.parent) {\n var es = require('event-stream')\n es.pipeline( //connect streams together with `pipe`\n process.openStdin(), //open stdin\n es.split(), //split stream to break on newlines\n es.map(function (data, callback) {//turn this async function into a stream\n callback(null\n , inspect(JSON.parse(data))) //render it nicely\n }),\n process.stdout // pipe it to stdout !\n )\n }\n```\nrun it ...\n\n``` bash \ncurl -sS registry.npmjs.org/event-stream | node pretty.js\n```\n \n[node Stream documentation](http://nodejs.org/api/stream.html)\n\n## through (write?, end?)\n\nReemits data synchronously. Easy way to create syncronous through streams.\nPass in an optional `write` and `end` methods. They will be called in the \ncontext of the stream. Use `this.pause()` and `this.resume()` to manage flow.\nCheck `this.paused` to see current flow state. (write always returns `!this.paused`)\n\nthis function is the basis for most of the syncronous streams in `event-stream`.\n\n``` js\n\nes.through(function write(data) {\n this.emit('data', data)\n //this.pause() \n },\n function end () { //optional\n this.emit('end')\n })\n\n```\n\n##map (asyncFunction)\n\nCreate a through stream from an asyncronous function. \n\n``` js\nvar es = require('event-stream')\n\nes.map(function (data, callback) {\n //transform data\n // ...\n callback(null, data)\n})\n\n```\n\nEach map MUST call the callback. It may callback with data, with an error or with no arguments, \n\n * `callback()` drop this data. \n this makes the map work like `filter`, \n note:`callback(null,null)` is not the same, and will emit `null`\n\n * `callback(null, newData)` turn data into newData\n \n * `callback(error)` emit an error for this item.\n\n>Note: if a callback is not called, `map` will think that it is still being processed, \n>every call must be answered or the stream will not know when to end. \n>\n>Also, if the callback is called more than once, every call but the first will be ignored.\n\n## mapSync (syncFunction)\n\nSame as `map`, but the callback is called synchronously. Based on `es.through`\n\n## split (matcher)\n\nBreak up a stream and reassemble it so that each line is a chunk. matcher may be a `String`, or a `RegExp` \n\nExample, read every line in a file ...\n\n``` js\n es.pipeline(\n fs.createReadStream(file, {flags: 'r'}),\n es.split(),\n es.map(function (line, cb) {\n //do something with the line \n cb(null, line)\n })\n )\n\n```\n\n`split` takes the same arguments as `string.split` except it defaults to '\\n' instead of ',', and the optional `limit` paremeter is ignored.\n[String#split](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String/split)\n\n## join (separator)\n\ncreate a through stream that emits `separator` between each chunk, just like Array#join.\n\n(for legacy reasons, if you pass a callback instead of a string, join is a synonym for `es.wait`)\n\n## replace (from, to)\n\nReplace all occurences of `from` with `to`. `from` may be a `String` or a `RegExp`. \nWorks just like `string.split(from).join(to)`, but streaming.\n\n\n## parse\n\nConvienience function for parsing JSON chunks. For newline separated JSON,\nuse with `es.split`\n\n``` js\nfs.createReadStream(filename)\n .pipe(es.split()) //defaults to lines.\n .pipe(es.parse())\n```\n\n## stringify\n\nconvert javascript objects into lines of text. The text will have whitespace escaped and have a `\\n` appended, so it will be compatible with `es.parse`\n\n``` js\nobjectStream\n .pipe(es.stringify())\n .pipe(fs.createWriteStream(filename))\n```\n\n##readable (asyncFunction) \n\ncreate a readable stream (that respects pause) from an async function. \nwhile the stream is not paused, \nthe function will be polled with `(count, callback)`, \nand `this` will be the readable stream.\n\n``` js\n\nes.readable(function (count, callback) {\n if(streamHasEnded)\n return this.emit('end')\n \n //...\n \n this.emit('data', data) //use this way to emit multiple chunks per call.\n \n callback() // you MUST always call the callback eventually.\n // the function will not be called again until you do this.\n})\n```\nyou can also pass the data and the error to the callback. \nyou may only call the callback once. \ncalling the same callback more than once will have no effect. \n\n##readArray (array)\n\nCreate a readable stream from an Array.\n\nJust emit each item as a data event, respecting `pause` and `resume`.\n\n``` js\n var es = require('event-stream')\n , reader = es.readArray([1,2,3])\n\n reader.pipe(...)\n```\n\n## writeArray (callback)\n\ncreate a writeable stream from a callback, \nall `data` events are stored in an array, which is passed to the callback when the stream ends.\n\n``` js\n var es = require('event-stream')\n , reader = es.readArray([1, 2, 3])\n , writer = es.writeArray(function (err, array){\n //array deepEqual [1, 2, 3]\n })\n\n reader.pipe(writer)\n```\n\n## pipeline (stream1,...,streamN)\n\nTurn a pipeline into a single stream. `pipeline` returns a stream that writes to the first stream\nand reads from the last stream. \n\nListening for 'error' will recieve errors from all streams inside the pipe.\n\n> `connect` is an alias for `pipeline`.\n\n``` js\n\n es.pipeline( //connect streams together with `pipe`\n process.openStdin(), //open stdin\n es.split(), //split stream to break on newlines\n es.map(function (data, callback) {//turn this async function into a stream\n callback(null\n , inspect(JSON.parse(data))) //render it nicely\n }),\n process.stdout // pipe it to stdout !\n )\n```\n\n## pause () \n\nA stream that buffers all chunks when paused.\n\n\n``` js\n var ps = es.pause()\n ps.pause() //buffer the stream, also do not allow 'end' \n ps.resume() //allow chunks through\n```\n\n## duplex (writeStream, readStream)\n\nTakes a writable stream and a readable stream and makes them appear as a readable writable stream.\n\nIt is assumed that the two streams are connected to each other in some way. \n\n(This is used by `pipeline` and `child`.)\n\n``` js\n var grep = cp.exec('grep Stream')\n\n es.duplex(grep.stdin, grep.stdout)\n```\n\n## child (child_process)\n\nCreate a through stream from a child process ...\n\n``` js\n var cp = require('child_process')\n\n es.child(cp.exec('grep Stream')) // a through stream\n\n```\n\n## wait (callback)\n\nwaits for stream to emit 'end'.\njoins chunks of a stream into a single string. \ntakes an optional callback, which will be passed the \ncomplete string when it receives the 'end' event.\n\nalso, emits a single 'data' event.\n\n``` js\n\nreadStream.pipe(es.join(function (err, text) {\n // have complete text here.\n}))\n\n```\n\n\n",
+ "_id": "event-stream@3.0.16",
+ "dist": {
+ "shasum": "0b040584bf4f31ca2d250d6a2ee285fea3e8e358"
+ },
+ "_from": "event-stream@~3.0.14"
+}
diff --git a/node_modules/jsftp/node_modules/event-stream/readme.markdown b/node_modules/jsftp/node_modules/event-stream/readme.markdown
new file mode 100644
index 0000000..4674c4e
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/readme.markdown
@@ -0,0 +1,291 @@
+# EventStream
+
+
+
+[![browser status](http://ci.testling.com/dominictarr/event-stream.png)]
+(http://ci.testling.com/dominictarr/event-stream)
+
+[Streams](http://nodejs.org/api/strems.html "Stream") are node's best and most misunderstood idea, and
+_EventStream_ is a toolkit to make creating and working with streams easy.
+
+Normally, streams are only used of IO,
+but in event stream we send all kinds of objects down the pipe.
+If your application's input and output are streams,
+shouldn't the throughput be a stream too?
+
+The *EventStream* functions resemble the array functions,
+because Streams are like Arrays, but laid out in time, rather than in memory.
+
+All the `event-stream` functions return instances of `Stream`.
+
+`event-stream` creates
+[0.8 streams](https://github.com/joyent/node/blob/v0.8/doc/api/stream.markdown)
+, which are compatible with [0.10 streams](http://nodejs.org/api/stream.html "Stream")
+
+>NOTE: I shall use the term "through stream" to refer to a stream that is writable and readable.
+
+###[simple example](https://github.com/dominictarr/event-stream/blob/master/examples/pretty.js):
+
+``` js
+
+//pretty.js
+
+if(!module.parent) {
+ var es = require('event-stream')
+ es.pipeline( //connect streams together with `pipe`
+ process.openStdin(), //open stdin
+ es.split(), //split stream to break on newlines
+ es.map(function (data, callback) {//turn this async function into a stream
+ callback(null
+ , inspect(JSON.parse(data))) //render it nicely
+ }),
+ process.stdout // pipe it to stdout !
+ )
+ }
+```
+run it ...
+
+``` bash
+curl -sS registry.npmjs.org/event-stream | node pretty.js
+```
+
+[node Stream documentation](http://nodejs.org/api/stream.html)
+
+## through (write?, end?)
+
+Reemits data synchronously. Easy way to create syncronous through streams.
+Pass in an optional `write` and `end` methods. They will be called in the
+context of the stream. Use `this.pause()` and `this.resume()` to manage flow.
+Check `this.paused` to see current flow state. (write always returns `!this.paused`)
+
+this function is the basis for most of the syncronous streams in `event-stream`.
+
+``` js
+
+es.through(function write(data) {
+ this.emit('data', data)
+ //this.pause()
+ },
+ function end () { //optional
+ this.emit('end')
+ })
+
+```
+
+##map (asyncFunction)
+
+Create a through stream from an asyncronous function.
+
+``` js
+var es = require('event-stream')
+
+es.map(function (data, callback) {
+ //transform data
+ // ...
+ callback(null, data)
+})
+
+```
+
+Each map MUST call the callback. It may callback with data, with an error or with no arguments,
+
+ * `callback()` drop this data.
+ this makes the map work like `filter`,
+ note:`callback(null,null)` is not the same, and will emit `null`
+
+ * `callback(null, newData)` turn data into newData
+
+ * `callback(error)` emit an error for this item.
+
+>Note: if a callback is not called, `map` will think that it is still being processed,
+>every call must be answered or the stream will not know when to end.
+>
+>Also, if the callback is called more than once, every call but the first will be ignored.
+
+## mapSync (syncFunction)
+
+Same as `map`, but the callback is called synchronously. Based on `es.through`
+
+## split (matcher)
+
+Break up a stream and reassemble it so that each line is a chunk. matcher may be a `String`, or a `RegExp`
+
+Example, read every line in a file ...
+
+``` js
+ es.pipeline(
+ fs.createReadStream(file, {flags: 'r'}),
+ es.split(),
+ es.map(function (line, cb) {
+ //do something with the line
+ cb(null, line)
+ })
+ )
+
+```
+
+`split` takes the same arguments as `string.split` except it defaults to '\n' instead of ',', and the optional `limit` paremeter is ignored.
+[String#split](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String/split)
+
+## join (separator)
+
+create a through stream that emits `separator` between each chunk, just like Array#join.
+
+(for legacy reasons, if you pass a callback instead of a string, join is a synonym for `es.wait`)
+
+## replace (from, to)
+
+Replace all occurences of `from` with `to`. `from` may be a `String` or a `RegExp`.
+Works just like `string.split(from).join(to)`, but streaming.
+
+
+## parse
+
+Convienience function for parsing JSON chunks. For newline separated JSON,
+use with `es.split`
+
+``` js
+fs.createReadStream(filename)
+ .pipe(es.split()) //defaults to lines.
+ .pipe(es.parse())
+```
+
+## stringify
+
+convert javascript objects into lines of text. The text will have whitespace escaped and have a `\n` appended, so it will be compatible with `es.parse`
+
+``` js
+objectStream
+ .pipe(es.stringify())
+ .pipe(fs.createWriteStream(filename))
+```
+
+##readable (asyncFunction)
+
+create a readable stream (that respects pause) from an async function.
+while the stream is not paused,
+the function will be polled with `(count, callback)`,
+and `this` will be the readable stream.
+
+``` js
+
+es.readable(function (count, callback) {
+ if(streamHasEnded)
+ return this.emit('end')
+
+ //...
+
+ this.emit('data', data) //use this way to emit multiple chunks per call.
+
+ callback() // you MUST always call the callback eventually.
+ // the function will not be called again until you do this.
+})
+```
+you can also pass the data and the error to the callback.
+you may only call the callback once.
+calling the same callback more than once will have no effect.
+
+##readArray (array)
+
+Create a readable stream from an Array.
+
+Just emit each item as a data event, respecting `pause` and `resume`.
+
+``` js
+ var es = require('event-stream')
+ , reader = es.readArray([1,2,3])
+
+ reader.pipe(...)
+```
+
+## writeArray (callback)
+
+create a writeable stream from a callback,
+all `data` events are stored in an array, which is passed to the callback when the stream ends.
+
+``` js
+ var es = require('event-stream')
+ , reader = es.readArray([1, 2, 3])
+ , writer = es.writeArray(function (err, array){
+ //array deepEqual [1, 2, 3]
+ })
+
+ reader.pipe(writer)
+```
+
+## pipeline (stream1,...,streamN)
+
+Turn a pipeline into a single stream. `pipeline` returns a stream that writes to the first stream
+and reads from the last stream.
+
+Listening for 'error' will recieve errors from all streams inside the pipe.
+
+> `connect` is an alias for `pipeline`.
+
+``` js
+
+ es.pipeline( //connect streams together with `pipe`
+ process.openStdin(), //open stdin
+ es.split(), //split stream to break on newlines
+ es.map(function (data, callback) {//turn this async function into a stream
+ callback(null
+ , inspect(JSON.parse(data))) //render it nicely
+ }),
+ process.stdout // pipe it to stdout !
+ )
+```
+
+## pause ()
+
+A stream that buffers all chunks when paused.
+
+
+``` js
+ var ps = es.pause()
+ ps.pause() //buffer the stream, also do not allow 'end'
+ ps.resume() //allow chunks through
+```
+
+## duplex (writeStream, readStream)
+
+Takes a writable stream and a readable stream and makes them appear as a readable writable stream.
+
+It is assumed that the two streams are connected to each other in some way.
+
+(This is used by `pipeline` and `child`.)
+
+``` js
+ var grep = cp.exec('grep Stream')
+
+ es.duplex(grep.stdin, grep.stdout)
+```
+
+## child (child_process)
+
+Create a through stream from a child process ...
+
+``` js
+ var cp = require('child_process')
+
+ es.child(cp.exec('grep Stream')) // a through stream
+
+```
+
+## wait (callback)
+
+waits for stream to emit 'end'.
+joins chunks of a stream into a single string.
+takes an optional callback, which will be passed the
+complete string when it receives the 'end' event.
+
+also, emits a single 'data' event.
+
+``` js
+
+readStream.pipe(es.join(function (err, text) {
+ // have complete text here.
+}))
+
+```
+
+
diff --git a/node_modules/jsftp/node_modules/event-stream/test/connect.asynct.js b/node_modules/jsftp/node_modules/event-stream/test/connect.asynct.js
new file mode 100644
index 0000000..e6a442b
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/test/connect.asynct.js
@@ -0,0 +1,86 @@
+var es = require('../')
+ , it = require('it-is').style('colour')
+ , d = require('ubelt')
+
+function makeExamplePipe() {
+
+ return es.connect(
+ es.map(function (data, callback) {
+ callback(null, data * 2)
+ }),
+ es.map(function (data, callback) {
+ d.delay(callback)(null, data)
+ }),
+ es.map(function (data, callback) {
+ callback(null, data + 2)
+ }))
+}
+
+exports['simple pipe'] = function (test) {
+
+ var pipe = makeExamplePipe()
+
+ pipe.on('data', function (data) {
+ it(data).equal(18)
+ test.done()
+ })
+
+ pipe.write(8)
+
+}
+
+exports['read array then map'] = function (test) {
+
+ var readThis = d.map(3, 6, 100, d.id) //array of multiples of 3 < 100
+ , first = es.readArray(readThis)
+ , read = []
+ , pipe =
+ es.connect(
+ first,
+ es.map(function (data, callback) {
+ callback(null, {data: data})
+ }),
+ es.map(function (data, callback) {
+ callback(null, {data: data})
+ }),
+ es.writeArray(function (err, array) {
+ it(array).deepEqual(d.map(readThis, function (data) {
+ return {data: {data: data}}
+ }))
+ test.done()
+ })
+ )
+}
+
+exports ['connect returns a stream'] = function (test) {
+
+ var rw =
+ es.connect(
+ es.map(function (data, callback) {
+ callback(null, data * 2)
+ }),
+ es.map(function (data, callback) {
+ callback(null, data * 5)
+ })
+ )
+
+ it(rw).has({readable: true, writable: true})
+
+ var array = [190, 24, 6, 7, 40, 57, 4, 6]
+ , _array = []
+ , c =
+ es.connect(
+ es.readArray(array),
+ rw,
+ es.log('after rw:'),
+ es.writeArray(function (err, _array) {
+ it(_array).deepEqual(array.map(function (e) { return e * 10 }))
+ test.done()
+ })
+ )
+
+}
+
+
+require('./helper')(module)
+
diff --git a/node_modules/jsftp/node_modules/event-stream/test/helper/index.js b/node_modules/jsftp/node_modules/event-stream/test/helper/index.js
new file mode 100644
index 0000000..96abaeb
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/test/helper/index.js
@@ -0,0 +1,12 @@
+var tape = require('tape')
+
+module.exports = function (m) {
+ if(m.parent) return
+ for(var name in m.exports) {
+ tape(name, function (t) {
+ console.log('start', name)
+ t.done = t.end
+ m.exports[name](t)
+ })
+ }
+}
diff --git a/node_modules/jsftp/node_modules/event-stream/test/merge.asynct.js b/node_modules/jsftp/node_modules/event-stream/test/merge.asynct.js
new file mode 100644
index 0000000..6ac65f3
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/test/merge.asynct.js
@@ -0,0 +1,21 @@
+var es = require('../')
+ , it = require('it-is').style('colour')
+ , d = require('ubelt')
+
+exports.merge = function (t) {
+ var odd = d.map(1, 3, 100, d.id) //array of multiples of 3 < 100
+ var even = d.map(2, 4, 100, d.id) //array of multiples of 3 < 100
+
+ var r1 = es.readArray(even)
+ var r2 = es.readArray(odd)
+
+ var writer = es.writeArray(function (err, array){
+ if(err) throw err //unpossible
+ it(array.sort()).deepEqual(even.concat(odd).sort())
+ t.done()
+ })
+
+ es.merge(r1, r2).pipe(writer)
+
+}
+require('./helper')(module)
diff --git a/node_modules/jsftp/node_modules/event-stream/test/pause.asynct.js b/node_modules/jsftp/node_modules/event-stream/test/pause.asynct.js
new file mode 100644
index 0000000..b073604
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/test/pause.asynct.js
@@ -0,0 +1,39 @@
+
+var es = require('../')
+ , it = require('it-is')
+ , d = require('ubelt')
+
+exports ['gate buffers when shut'] = function (test) {
+
+ var hundy = d.map(1,100, d.id)
+ , gate = es.pause()
+ , ten = 10
+ es.connect(
+ es.readArray(hundy),
+ es.log('after readArray'),
+ gate,
+ //es.log('after gate'),
+ es.map(function (num, next) {
+ //stick a map in here to check that gate never emits when open
+ it(gate.paused).equal(false)
+ console.log('data', num)
+ if(!--ten) {
+ console.log('PAUSE')
+ gate.pause()//.resume()
+ d.delay(gate.resume.bind(gate), 10)()
+ ten = 10
+ }
+
+ next(null, num)
+ }),
+ es.writeArray(function (err, array) { //just realized that I should remove the error param. errors will be emitted
+ console.log('eonuhoenuoecbulc')
+ it(array).deepEqual(hundy)
+ test.done()
+ })
+ )
+
+ gate.resume()
+
+}
+require('./helper')(module)
diff --git a/node_modules/jsftp/node_modules/event-stream/test/pipeline.asynct.js b/node_modules/jsftp/node_modules/event-stream/test/pipeline.asynct.js
new file mode 100644
index 0000000..f07c6fa
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/test/pipeline.asynct.js
@@ -0,0 +1,52 @@
+var es = require('..')
+
+exports['do not duplicate errors'] = function (test) {
+
+ var errors = 0;
+ var pipe = es.pipeline(
+ es.through(function(data) {
+ return this.emit('data', data);
+ }),
+ es.through(function(data) {
+ return this.emit('error', new Error(data));
+ })
+ )
+
+ pipe.on('error', function(err) {
+ errors++
+ console.log('error count', errors)
+ process.nextTick(function () {
+ return test.done();
+ })
+ })
+
+ return pipe.write('meh');
+
+}
+
+exports['3 pipe do not duplicate errors'] = function (test) {
+
+ var errors = 0;
+ var pipe = es.pipeline(
+ es.through(function(data) {
+ return this.emit('data', data);
+ }),
+ es.through(function(data) {
+ return this.emit('error', new Error(data));
+ }),
+ es.through()
+ )
+
+ pipe.on('error', function(err) {
+ errors++
+ console.log('error count', errors)
+ process.nextTick(function () {
+ return test.done();
+ })
+ })
+
+ return pipe.write('meh');
+
+}
+
+require('./helper')(module)
diff --git a/node_modules/jsftp/node_modules/event-stream/test/readArray.asynct.js b/node_modules/jsftp/node_modules/event-stream/test/readArray.asynct.js
new file mode 100644
index 0000000..3eeb90a
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/test/readArray.asynct.js
@@ -0,0 +1,89 @@
+
+var es = require('../')
+ , it = require('it-is').style('colour')
+ , d = require('ubelt')
+
+function readStream(stream, pauseAt, done) {
+ if(!done) done = pauseAt, pauseAt = -1
+ var array = []
+ stream.on('data', function (data) {
+ array.push(data)
+ if(!--pauseAt )
+ stream.pause(), done(null, array)
+ })
+ stream.on('error', done)
+ stream.on('end', function (data) {
+ done(null, array)
+ })
+
+}
+
+exports ['read an array'] = function (test) {
+
+ var readThis = d.map(3, 6, 100, d.id) //array of multiples of 3 < 100
+
+ var reader = es.readArray(readThis)
+
+ var writer = es.writeArray(function (err, array){
+ if(err) throw err //unpossible
+ it(array).deepEqual(readThis)
+ test.done()
+ })
+
+ reader.pipe(writer)
+}
+
+exports ['read an array and pause it.'] = function (test) {
+
+ var readThis = d.map(3, 6, 100, d.id) //array of multiples of 3 < 100
+
+ var reader = es.readArray(readThis)
+
+ readStream(reader, 10, function (err, data) {
+ if(err) throw err
+ it(data).deepEqual([3, 6, 9, 12, 15, 18, 21, 24, 27, 30])
+ readStream(reader, 10, function (err, data) {
+ it(data).deepEqual([33, 36, 39, 42, 45, 48, 51, 54, 57, 60])
+ test.done()
+ })
+ reader.resume()
+ })
+
+}
+
+exports ['reader is readable, but not writeable'] = function (test) {
+ var reader = es.readArray([1])
+ it(reader).has({
+ readable: true,
+ writable: false
+ })
+
+ test.done()
+}
+
+
+exports ['read one item per tick'] = function (test) {
+ var readThis = d.map(3, 6, 100, d.id) //array of multiples of 3 < 100
+ var drains = 0
+ var reader = es.readArray(readThis)
+ var tickMapper = es.map(function (data,callback) {
+ process.nextTick(function () {
+ callback(null, data)
+ })
+ //since tickMapper is returning false
+ //pipe should pause the writer until a drain occurs
+ return false
+ })
+ reader.pipe(tickMapper)
+ readStream(tickMapper, function (err, array) {
+ it(array).deepEqual(readThis)
+ it(array.length).deepEqual(readThis.length)
+ it(drains).equal(readThis.length)
+ test.done()
+ })
+ tickMapper.on('drain', function () {
+ drains ++
+ })
+
+}
+require('./helper')(module)
diff --git a/node_modules/jsftp/node_modules/event-stream/test/readable.asynct.js b/node_modules/jsftp/node_modules/event-stream/test/readable.asynct.js
new file mode 100644
index 0000000..a33988c
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/test/readable.asynct.js
@@ -0,0 +1,175 @@
+
+var es = require('../')
+ , it = require('it-is').style('colour')
+ , u = require('ubelt')
+
+exports ['read an array'] = function (test) {
+
+
+ console.log('readable')
+ return test.end()
+ var readThis = u.map(3, 6, 100, u.id) //array of multiples of 3 < 100
+
+ console.log('readable')
+
+ var reader =
+ es.readable(function (i, callback) {
+ if(i >= readThis.length)
+ return this.emit('end')
+ console.log('readable')
+ callback(null, readThis[i])
+ })
+
+ var writer = es.writeArray(function (err, array){
+ if(err) throw err
+ it(array).deepEqual(readThis)
+ test.done()
+ })
+
+ reader.pipe(writer)
+}
+
+exports ['read an array - async'] = function (test) {
+
+ var readThis = u.map(3, 6, 100, u.id) //array of multiples of 3 < 100
+
+ var reader =
+ es.readable(function (i, callback) {
+ if(i >= readThis.length)
+ return this.emit('end')
+ u.delay(callback)(null, readThis[i])
+ })
+
+ var writer = es.writeArray(function (err, array){
+ if(err) throw err
+ it(array).deepEqual(readThis)
+ test.done()
+ })
+
+ reader.pipe(writer)
+}
+
+
+exports ['emit data then call next() also works'] = function (test) {
+
+ var readThis = u.map(3, 6, 100, u.id) //array of multiples of 3 < 100
+
+ var reader =
+ es.readable(function (i, next) {
+ if(i >= readThis.length)
+ return this.emit('end')
+ this.emit('data', readThis[i])
+ next()
+ })
+
+ var writer = es.writeArray(function (err, array){
+ if(err) throw err
+ it(array).deepEqual(readThis)
+ test.done()
+ })
+
+ reader.pipe(writer)
+}
+
+
+exports ['callback emits error, then stops'] = function (test) {
+
+ var err = new Error('INTENSIONAL ERROR')
+ , called = 0
+
+ var reader =
+ es.readable(function (i, callback) {
+ if(called++)
+ return
+ callback(err)
+ })
+
+ reader.on('error', function (_err){
+ it(_err).deepEqual(err)
+ u.delay(function() {
+ it(called).equal(1)
+ test.done()
+ }, 50)()
+ })
+}
+
+exports['readable does not call read concurrently'] = function (test) {
+
+ var current = 0
+ var source = es.readable(function(count, cb){
+ current ++
+ if(count > 100)
+ return this.emit('end')
+ u.delay(function(){
+ current --
+ it(current).equal(0)
+ cb(null, {ok: true, n: count});
+ })();
+ });
+
+ var destination = es.map(function(data, cb){
+ //console.info(data);
+ cb();
+ });
+
+ var all = es.connect(source, destination);
+
+ destination.on('end', test.done)
+}
+
+
+//
+// emitting multiple errors is not supported by stream.
+//
+// I do not think that this is a good idea, at least, there should be an option to pipe to
+// continue on error. it makes alot ef sense, if you are using Stream like I am, to be able to emit multiple errors.
+// an error might not necessarily mean the end of the stream. it depends on the error, at least.
+//
+// I will start a thread on the mailing list. I'd rather that than use a custom `pipe` implementation.
+//
+// basically, I want to be able use pipe to transform objects, and if one object is invalid,
+// the next might still be good, so I should get to choose if it's gonna stop.
+// re-enstate this test when this issue progresses.
+//
+// hmm. I could add this to es.connect by deregistering the error listener,
+// but I would rather it be an option in core.
+
+/*
+exports ['emit multiple errors, with 2nd parameter (continueOnError)'] = function (test) {
+
+ var readThis = d.map(1, 100, d.id)
+ , errors = 0
+ var reader =
+ es.readable(function (i, callback) {
+ console.log(i, readThis.length)
+ if(i >= readThis.length)
+ return this.emit('end')
+ if(!(readThis[i] % 7))
+ return callback(readThis[i])
+ callback(null, readThis[i])
+ }, true)
+
+ var writer = es.writeArray(function (err, array) {
+ if(err) throw err
+ it(array).every(function (u){
+ it(u % 7).notEqual(0)
+ }).property('length', 80)
+ it(errors).equal(14)
+ test.done()
+ })
+
+ reader.on('error', function (u) {
+ errors ++
+ console.log(u)
+ if('number' !== typeof u)
+ throw u
+
+ it(u % 7).equal(0)
+
+ })
+
+ reader.pipe(writer)
+}
+*/
+
+require('./helper')(module)
diff --git a/node_modules/jsftp/node_modules/event-stream/test/replace.asynct.js b/node_modules/jsftp/node_modules/event-stream/test/replace.asynct.js
new file mode 100644
index 0000000..382082f
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/test/replace.asynct.js
@@ -0,0 +1,51 @@
+var es = require('../')
+ , it = require('it-is').style('colour')
+ , d = require('ubelt')
+ , spec = require('stream-spec')
+
+var next = process.nextTick
+
+var fizzbuzz = '12F4BF78FB11F1314FB1617F19BF2223FB26F2829FB3132F34BF3738FB41F4344FB4647F49BF5253FB56F5859FB6162F64BF6768FB71F7374FB7677F79BF8283FB86F8889FB9192F94BF9798FB'
+ , fizz7buzz = '12F4BFseven8FB11F1314FB161sevenF19BF2223FB26F2829FB3132F34BF3seven38FB41F4344FB464sevenF49BF5253FB56F5859FB6162F64BF6seven68FBseven1Fseven3seven4FBseven6sevensevenFseven9BF8283FB86F8889FB9192F94BF9seven98FB'
+
+exports ['fizz buzz'] = function (test) {
+
+ var readThis = d.map(1, 100, function (i) {
+ return (
+ ! (i % 3 || i % 5) ? "FB" :
+ !(i % 3) ? "F" :
+ !(i % 5) ? "B" :
+ ''+i
+ )
+ }) //array of multiples of 3 < 100
+
+ var reader = es.readArray(readThis)
+ var join = es.wait(function (err, string){
+ it(string).equal(fizzbuzz)
+ test.done()
+ })
+ reader.pipe(join)
+
+}
+
+
+exports ['fizz buzz replace'] = function (test) {
+ var split = es.split(/(1)/)
+ var replace = es.replace('7', 'seven')
+ var x = spec(replace).through()
+ split
+ .pipe(replace)
+ .pipe(es.join(function (err, string) {
+ it(string).equal(fizz7buzz)
+ }))
+
+ replace.on('close', function () {
+ x.validate()
+ test.done()
+ })
+
+ split.write(fizzbuzz)
+ split.end()
+
+}
+require('./helper')(module)
diff --git a/node_modules/jsftp/node_modules/event-stream/test/simple-map.asynct.js b/node_modules/jsftp/node_modules/event-stream/test/simple-map.asynct.js
new file mode 100644
index 0000000..25121f9
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/test/simple-map.asynct.js
@@ -0,0 +1,343 @@
+'use strict';
+
+var es = require('../')
+ , it = require('it-is')
+ , u = require('ubelt')
+ , spec = require('stream-spec')
+ , Stream = require('stream')
+ , from = require('from')
+ , through = require('through')
+
+//REFACTOR THIS TEST TO USE es.readArray and es.writeArray
+
+function writeArray(array, stream) {
+
+ array.forEach( function (j) {
+ stream.write(j)
+ })
+ stream.end()
+
+}
+
+function readStream(stream, done) {
+
+ var array = []
+ stream.on('data', function (data) {
+ array.push(data)
+ })
+ stream.on('error', done)
+ stream.on('end', function (data) {
+ done(null, array)
+ })
+
+}
+
+//call sink on each write,
+//and complete when finished.
+
+function pauseStream (prob, delay) {
+ var pauseIf = (
+ 'number' == typeof prob
+ ? function () {
+ return Math.random() < prob
+ }
+ : 'function' == typeof prob
+ ? prob
+ : 0.1
+ )
+ var delayer = (
+ !delay
+ ? process.nextTick
+ : 'number' == typeof delay
+ ? function (next) { setTimeout(next, delay) }
+ : delay
+ )
+
+ return es.through(function (data) {
+ if(!this.paused && pauseIf()) {
+ console.log('PAUSE STREAM PAUSING')
+ this.pause()
+ var self = this
+ delayer(function () {
+ console.log('PAUSE STREAM RESUMING')
+ self.resume()
+ })
+ }
+ console.log("emit ('data', " + data + ')')
+ this.emit('data', data)
+ })
+}
+
+exports ['simple map'] = function (test) {
+
+ var input = u.map(1, 1000, function () {
+ return Math.random()
+ })
+ var expected = input.map(function (v) {
+ return v * 2
+ })
+
+ var pause = pauseStream(0.1)
+ var fs = from(input)
+ var ts = es.writeArray(function (err, ar) {
+ it(ar).deepEqual(expected)
+ test.done()
+ })
+ var map = es.through(function (data) {
+ this.emit('data', data * 2)
+ })
+
+ spec(map).through().validateOnExit()
+ spec(pause).through().validateOnExit()
+
+ fs.pipe(map).pipe(pause).pipe(ts)
+}
+
+exports ['simple map applied to a stream'] = function (test) {
+
+ var input = [1,2,3,7,5,3,1,9,0,2,4,6]
+ //create event stream from
+
+ var doubler = es.map(function (data, cb) {
+ cb(null, data * 2)
+ })
+
+ spec(doubler).through().validateOnExit()
+
+ //a map is only a middle man, so it is both readable and writable
+
+ it(doubler).has({
+ readable: true,
+ writable: true,
+ })
+
+ readStream(doubler, function (err, output) {
+ it(output).deepEqual(input.map(function (j) {
+ return j * 2
+ }))
+// process.nextTick(x.validate)
+ test.done()
+ })
+
+ writeArray(input, doubler)
+
+}
+
+exports['pipe two maps together'] = function (test) {
+
+ var input = [1,2,3,7,5,3,1,9,0,2,4,6]
+ //create event stream from
+ function dd (data, cb) {
+ cb(null, data * 2)
+ }
+ var doubler1 = es.map(dd), doubler2 = es.map(dd)
+
+ doubler1.pipe(doubler2)
+
+ spec(doubler1).through().validateOnExit()
+ spec(doubler2).through().validateOnExit()
+
+ readStream(doubler2, function (err, output) {
+ it(output).deepEqual(input.map(function (j) {
+ return j * 4
+ }))
+ test.done()
+ })
+
+ writeArray(input, doubler1)
+
+}
+
+//next:
+//
+// test pause, resume and drian.
+//
+
+// then make a pipe joiner:
+//
+// plumber (evStr1, evStr2, evStr3, evStr4, evStr5)
+//
+// will return a single stream that write goes to the first
+
+exports ['map will not call end until the callback'] = function (test) {
+
+ var ticker = es.map(function (data, cb) {
+ process.nextTick(function () {
+ cb(null, data * 2)
+ })
+ })
+
+ spec(ticker).through().validateOnExit()
+
+ ticker.write('x')
+ ticker.end()
+
+ ticker.on('end', function () {
+ test.done()
+ })
+}
+
+
+exports ['emit error thrown'] = function (test) {
+
+ var err = new Error('INTENSIONAL ERROR')
+ , mapper =
+ es.map(function () {
+ throw err
+ })
+
+ mapper.on('error', function (_err) {
+ it(_err).equal(err)
+ test.done()
+ })
+
+// onExit(spec(mapper).basic().validate)
+//need spec that says stream may error.
+
+ mapper.write('hello')
+
+}
+
+exports ['emit error calledback'] = function (test) {
+
+ var err = new Error('INTENSIONAL ERROR')
+ , mapper =
+ es.map(function (data, callback) {
+ callback(err)
+ })
+
+ mapper.on('error', function (_err) {
+ it(_err).equal(err)
+ test.done()
+ })
+
+ mapper.write('hello')
+
+}
+
+exports ['do not emit drain if not paused'] = function (test) {
+
+ var map = es.map(function (data, callback) {
+ u.delay(callback)(null, 1)
+ return true
+ })
+
+ spec(map).through().pausable().validateOnExit()
+
+ map.on('drain', function () {
+ it(false).ok('should not emit drain unless the stream is paused')
+ })
+
+ it(map.write('hello')).equal(true)
+ it(map.write('hello')).equal(true)
+ it(map.write('hello')).equal(true)
+ setTimeout(function () {map.end()},10)
+ map.on('end', test.done)
+}
+
+exports ['emits drain if paused, when all '] = function (test) {
+ var active = 0
+ var drained = false
+ var map = es.map(function (data, callback) {
+ active ++
+ u.delay(function () {
+ active --
+ callback(null, 1)
+ })()
+ console.log('WRITE', false)
+ return false
+ })
+
+ spec(map).through().validateOnExit()
+
+ map.on('drain', function () {
+ drained = true
+ it(active).equal(0, 'should emit drain when all maps are done')
+ })
+
+ it(map.write('hello')).equal(false)
+ it(map.write('hello')).equal(false)
+ it(map.write('hello')).equal(false)
+
+ process.nextTick(function () {map.end()},10)
+
+ map.on('end', function () {
+ console.log('end')
+ it(drained).ok('shoud have emitted drain before end')
+ test.done()
+ })
+
+}
+
+exports ['map applied to a stream with filtering'] = function (test) {
+
+ var input = [1,2,3,7,5,3,1,9,0,2,4,6]
+
+ var doubler = es.map(function (data, callback) {
+ if (data % 2)
+ callback(null, data * 2)
+ else
+ callback()
+ })
+
+ readStream(doubler, function (err, output) {
+ it(output).deepEqual(input.filter(function (j) {
+ return j % 2
+ }).map(function (j) {
+ return j * 2
+ }))
+ test.done()
+ })
+
+ spec(doubler).through().validateOnExit()
+
+ writeArray(input, doubler)
+
+}
+
+exports ['simple mapSync applied to a stream'] = function (test) {
+
+ var input = [1,2,3,7,5,3,1,9,0,2,4,6]
+
+ var doubler = es.mapSync(function (data) {
+ return data * 2
+ })
+
+ readStream(doubler, function (err, output) {
+ it(output).deepEqual(input.map(function (j) {
+ return j * 2
+ }))
+ test.done()
+ })
+
+ spec(doubler).through().validateOnExit()
+
+ writeArray(input, doubler)
+
+}
+
+exports ['mapSync applied to a stream with filtering'] = function (test) {
+
+ var input = [1,2,3,7,5,3,1,9,0,2,4,6]
+
+ var doubler = es.mapSync(function (data) {
+ if (data % 2)
+ return data * 2
+ })
+
+ readStream(doubler, function (err, output) {
+ it(output).deepEqual(input.filter(function (j) {
+ return j % 2
+ }).map(function (j) {
+ return j * 2
+ }))
+ test.done()
+ })
+
+ spec(doubler).through().validateOnExit()
+
+ writeArray(input, doubler)
+
+}
+
+require('./helper')(module)
diff --git a/node_modules/jsftp/node_modules/event-stream/test/spec.asynct.js b/node_modules/jsftp/node_modules/event-stream/test/spec.asynct.js
new file mode 100644
index 0000000..6d5fb6b
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/test/spec.asynct.js
@@ -0,0 +1,86 @@
+/*
+ assert that data is called many times
+ assert that end is called eventually
+
+ assert that when stream enters pause state,
+ on drain is emitted eventually.
+*/
+
+var es = require('..')
+var it = require('it-is').style('colour')
+var spec = require('stream-spec')
+
+exports['simple stream'] = function (test) {
+
+ var stream = es.through()
+ var x = spec(stream).basic().pausable()
+
+ stream.write(1)
+ stream.write(1)
+ stream.pause()
+ stream.write(1)
+ stream.resume()
+ stream.write(1)
+ stream.end(2) //this will call write()
+
+ process.nextTick(function (){
+ x.validate()
+ test.done()
+ })
+}
+
+exports['throw on write when !writable'] = function (test) {
+
+ var stream = es.through()
+ var x = spec(stream).basic().pausable()
+
+ stream.write(1)
+ stream.write(1)
+ stream.end(2) //this will call write()
+ stream.write(1) //this will be throwing..., but the spec will catch it.
+
+ process.nextTick(function () {
+ x.validate()
+ test.done()
+ })
+
+}
+
+exports['end fast'] = function (test) {
+
+ var stream = es.through()
+ var x = spec(stream).basic().pausable()
+
+ stream.end() //this will call write()
+
+ process.nextTick(function () {
+ x.validate()
+ test.done()
+ })
+
+}
+
+
+/*
+ okay, that was easy enough, whats next?
+
+ say, after you call paused(), write should return false
+ until resume is called.
+
+ simple way to implement this:
+ write must return !paused
+ after pause() paused = true
+ after resume() paused = false
+
+ on resume, if !paused drain is emitted again.
+ after drain, !paused
+
+ there are lots of subtle ordering bugs in streams.
+
+ example, set !paused before emitting drain.
+
+ the stream api is stateful.
+*/
+
+
+require('./helper')(module)
diff --git a/node_modules/jsftp/node_modules/event-stream/test/split.asynct.js b/node_modules/jsftp/node_modules/event-stream/test/split.asynct.js
new file mode 100644
index 0000000..7d44bac
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/test/split.asynct.js
@@ -0,0 +1,47 @@
+var es = require('../')
+ , it = require('it-is').style('colour')
+ , d = require('ubelt')
+ , join = require('path').join
+ , fs = require('fs')
+ , Stream = require('stream').Stream
+ , spec = require('stream-spec')
+
+exports ['es.split() works like String#split'] = function (test) {
+ var readme = join(__filename)
+ , expected = fs.readFileSync(readme, 'utf-8').split('\n')
+ , cs = es.split()
+ , actual = []
+ , ended = false
+ , x = spec(cs).through()
+
+ var a = new Stream ()
+
+ a.write = function (l) {
+ actual.push(l.trim())
+ }
+ a.end = function () {
+
+ ended = true
+ expected.forEach(function (v,k) {
+ //String.split will append an empty string ''
+ //if the string ends in a split pattern.
+ //es.split doesn't which was breaking this test.
+ //clearly, appending the empty string is correct.
+ //tests are passing though. which is the current job.
+ if(v)
+ it(actual[k]).like(v)
+ })
+ //give the stream time to close
+ process.nextTick(function () {
+ test.done()
+ x.validate()
+ })
+ }
+ a.writable = true
+
+ fs.createReadStream(readme, {flags: 'r'}).pipe(cs)
+ cs.pipe(a)
+
+}
+
+require('./helper')(module)
diff --git a/node_modules/jsftp/node_modules/event-stream/test/stringify.js b/node_modules/jsftp/node_modules/event-stream/test/stringify.js
new file mode 100644
index 0000000..d158185
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/test/stringify.js
@@ -0,0 +1,15 @@
+
+
+
+var es = require('../')
+
+exports['handle buffer'] = function (t) {
+
+
+ es.stringify().on('data', function (d) {
+ t.equal(d.trim(), JSON.stringify('HELLO'))
+ t.end()
+ }).write(new Buffer('HELLO'))
+
+}
+require('./helper')(module)
diff --git a/node_modules/jsftp/node_modules/event-stream/test/writeArray.asynct.js b/node_modules/jsftp/node_modules/event-stream/test/writeArray.asynct.js
new file mode 100644
index 0000000..5d705de
--- /dev/null
+++ b/node_modules/jsftp/node_modules/event-stream/test/writeArray.asynct.js
@@ -0,0 +1,31 @@
+
+var es = require('../')
+ , it = require('it-is').style('colour')
+ , d = require('ubelt')
+
+exports ['write an array'] = function (test) {
+
+ var readThis = d.map(3, 6, 100, d.id) //array of multiples of 3 < 100
+
+ var writer = es.writeArray(function (err, array){
+ if(err) throw err //unpossible
+ it(array).deepEqual(readThis)
+ test.done()
+ })
+
+ d.each(readThis, writer.write.bind(writer))
+ writer.end()
+
+}
+
+
+exports ['writer is writable, but not readable'] = function (test) {
+ var reader = es.writeArray(function () {})
+ it(reader).has({
+ readable: false,
+ writable: true
+ })
+
+ test.done()
+}
+require('./helper')(module)
diff --git a/node_modules/jsftp/node_modules/parse-listing/..gitignore.un~ b/node_modules/jsftp/node_modules/parse-listing/..gitignore.un~
new file mode 100644
index 0000000..ca0ee26
Binary files /dev/null and b/node_modules/jsftp/node_modules/parse-listing/..gitignore.un~ differ
diff --git a/node_modules/jsftp/node_modules/parse-listing/..travis.yml.un~ b/node_modules/jsftp/node_modules/parse-listing/..travis.yml.un~
new file mode 100644
index 0000000..4612490
Binary files /dev/null and b/node_modules/jsftp/node_modules/parse-listing/..travis.yml.un~ differ
diff --git a/node_modules/jsftp/node_modules/parse-listing/.Makefile.un~ b/node_modules/jsftp/node_modules/parse-listing/.Makefile.un~
new file mode 100644
index 0000000..80d06e7
Binary files /dev/null and b/node_modules/jsftp/node_modules/parse-listing/.Makefile.un~ differ
diff --git a/node_modules/jsftp/node_modules/parse-listing/.README.md.un~ b/node_modules/jsftp/node_modules/parse-listing/.README.md.un~
new file mode 100644
index 0000000..1fc33a3
Binary files /dev/null and b/node_modules/jsftp/node_modules/parse-listing/.README.md.un~ differ
diff --git a/node_modules/jsftp/node_modules/parse-listing/.idea/.name b/node_modules/jsftp/node_modules/parse-listing/.idea/.name
new file mode 100644
index 0000000..89accd2
--- /dev/null
+++ b/node_modules/jsftp/node_modules/parse-listing/.idea/.name
@@ -0,0 +1 @@
+parse-listing
\ No newline at end of file
diff --git a/node_modules/jsftp/node_modules/parse-listing/.idea/encodings.xml b/node_modules/jsftp/node_modules/parse-listing/.idea/encodings.xml
new file mode 100644
index 0000000..e206d70
--- /dev/null
+++ b/node_modules/jsftp/node_modules/parse-listing/.idea/encodings.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/node_modules/jsftp/node_modules/parse-listing/.idea/inspectionProfiles/Project_Default.xml b/node_modules/jsftp/node_modules/parse-listing/.idea/inspectionProfiles/Project_Default.xml
new file mode 100644
index 0000000..c66df00
--- /dev/null
+++ b/node_modules/jsftp/node_modules/parse-listing/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/node_modules/jsftp/node_modules/parse-listing/.idea/inspectionProfiles/profiles_settings.xml b/node_modules/jsftp/node_modules/parse-listing/.idea/inspectionProfiles/profiles_settings.xml
new file mode 100644
index 0000000..3b31283
--- /dev/null
+++ b/node_modules/jsftp/node_modules/parse-listing/.idea/inspectionProfiles/profiles_settings.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/node_modules/jsftp/node_modules/parse-listing/.idea/misc.xml b/node_modules/jsftp/node_modules/parse-listing/.idea/misc.xml
new file mode 100644
index 0000000..d16ceba
--- /dev/null
+++ b/node_modules/jsftp/node_modules/parse-listing/.idea/misc.xml
@@ -0,0 +1,22 @@
+
+
+
+
+