promise-ftp
Advanced tools
Comparing version 1.3.2 to 1.3.3
@@ -10,3 +10,3 @@ // Generated by CoffeeScript 1.10.0 | ||
'use strict'; | ||
var FtpClient, FtpConnectionError, FtpReconnectError, PromiseFtp, STATUSES, complexPassthroughMethods, otherPrototypeMethods, path, simplePassthroughMethods, | ||
var FtpClient, FtpConnectionError, FtpReconnectError, Promise, PromiseFtp, STATUSES, complexPassthroughMethods, otherPrototypeMethods, path, simplePassthroughMethods, | ||
slice = [].slice; | ||
@@ -16,2 +16,4 @@ | ||
Promise = require('bluebird'); | ||
path = require('path'); | ||
@@ -87,3 +89,3 @@ | ||
this.connect = function(options) { | ||
return Promise.resolve().then(function() { | ||
return Promise["try"](function() { | ||
var key, ref, value; | ||
@@ -114,3 +116,3 @@ if (connectionStatus !== STATUSES.NOT_YET_CONNECTED && connectionStatus !== STATUSES.DISCONNECTED) { | ||
this.reconnect = function() { | ||
return Promise.resolve().then(function() { | ||
return Promise["try"](function() { | ||
if (connectionStatus !== STATUSES.NOT_YET_CONNECTED && connectionStatus !== STATUSES.DISCONNECTED) { | ||
@@ -184,19 +186,3 @@ throw new FtpConnectionError("can't reconnect when connection status is: '" + connectionStatus + "'"); | ||
commonLogicFactory = function(name, handler) { | ||
promisifiedClientMethods[name] = function() { | ||
var args; | ||
args = 1 <= arguments.length ? slice.call(arguments, 0) : []; | ||
return new Promise(function(resolve, reject) { | ||
return client[name].apply(client, slice.call(args).concat([function() { | ||
var err, res; | ||
err = arguments[0], res = 2 <= arguments.length ? slice.call(arguments, 1) : []; | ||
if (err) { | ||
return reject(err); | ||
} else if (res.length === 1) { | ||
return resolve(res[0]); | ||
} else { | ||
return resolve(res); | ||
} | ||
}])); | ||
}); | ||
}; | ||
promisifiedClientMethods[name] = Promise.promisify(client[name], client); | ||
if (!handler) { | ||
@@ -208,3 +194,3 @@ handler = promisifiedClientMethods[name]; | ||
args = 1 <= arguments.length ? slice.call(arguments, 0) : []; | ||
return Promise.resolve().then((function(_this) { | ||
return Promise["try"]((function(_this) { | ||
return function() { | ||
@@ -211,0 +197,0 @@ if (unexpectedClose && autoReconnect && !autoReconnectPromise) { |
{ | ||
"name": "promise-ftp", | ||
"description": "a promise-based ftp client for node.js", | ||
"version": "1.3.2", | ||
"version": "1.3.3", | ||
"main": "index.js", | ||
@@ -26,2 +26,3 @@ "author": "RealtyMaps", | ||
"dependencies": { | ||
"bluebird": "2.x", | ||
"ftp": "0.3.10", | ||
@@ -28,0 +29,0 @@ "promise-ftp-common": "^1.1.5" |
25401
4
256
+ Addedbluebird@2.x
+ Addedbluebird@2.11.0(transitive)