Comparing version 0.1.5 to 0.1.6
30
ftp.js
@@ -290,7 +290,9 @@ var util = require('util'), | ||
FTP.prototype.put = function(instream, destpath, cb) { | ||
if (this._state !== 'authorized' || !instream.readable) | ||
FTP.prototype.put = function(input, destpath, cb) { | ||
var isBuffer = Buffer.isBuffer(input); | ||
if (this._state !== 'authorized' || (!isBuffer && !input.readable)) | ||
return false; | ||
instream.pause(); | ||
if (!isBuffer) | ||
input.pause(); | ||
@@ -305,4 +307,7 @@ var self = this; | ||
if (r) { | ||
instream.pipe(outstream); | ||
instream.resume(); | ||
if (!isBuffer) { | ||
input.pipe(outstream); | ||
input.resume(); | ||
} else | ||
outstream.end(input); | ||
} else | ||
@@ -313,7 +318,9 @@ cb(new Error('Connection severed')); | ||
FTP.prototype.append = function(instream, destpath, cb) { | ||
if (this._state !== 'authorized' || !instream.readable) | ||
FTP.prototype.append = function(input, destpath, cb) { | ||
var isBuffer = Buffer.isBuffer(input); | ||
if (this._state !== 'authorized' || (!isBuffer && !input.readable)) | ||
return false; | ||
instream.pause(); | ||
if (!isBuffer) | ||
input.pause(); | ||
@@ -327,4 +334,7 @@ var self = this; | ||
if (r) { | ||
instream.resume(); | ||
instream.pipe(outstream); | ||
if (!isBuffer) { | ||
input.resume(); | ||
input.pipe(outstream); | ||
} else | ||
outstream.end(input); | ||
} | ||
@@ -331,0 +341,0 @@ else |
{ "name": "ftp", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"author": "Brian White <mscdex@mscdex.net>", | ||
@@ -4,0 +4,0 @@ "description": "An FTP client module for node.js", |
@@ -162,5 +162,5 @@ Description | ||
* **put**(<_ReadableStream_>inStream, <_string_>filename, <_function_>callback) - <_boolean_>success - Sends a file to the server. The callback has these parameters: the error (undefined if none). | ||
* **put**(<_mixed_>input, <_string_>filename, <_function_>callback) - <_boolean_>success - Sends a file to the server. The `input` can be a ReadableStream or a single Buffer. The callback has these parameters: the error (undefined if none). | ||
* **append**(<_ReadableStream_>inStream, <_string_>filename, <_function_>callback) - <_boolean_>success - Same as **put**, except if the file already exists, it will be appended to instead of overwritten. | ||
* **append**(<_mixed_>input, <_string_>filename, <_function_>callback) - <_boolean_>success - Same as **put**, except if the file already exists, it will be appended to instead of overwritten. | ||
@@ -167,0 +167,0 @@ * **mkdir**(<_string_>dirname, <_function_>callback) - <_boolean_>success - Creates a new directory on the server. The callback has these parameters: the error (undefined if none) and a string containing the path of the newly created directory. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
42799
772