From 7c9fce446087deb3dd5a0f64daebaa00b32842b5 Mon Sep 17 00:00:00 2001 From: dcolens Date: Wed, 3 Jun 2015 16:38:15 +0200 Subject: [PATCH] fix for #70 - call resume before the callback so that consumers can use pause() as expected - send end event when data is consumed after a get --- lib/connection.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/connection.js b/lib/connection.js index ca35eea..f5f4465 100644 --- a/lib/connection.js +++ b/lib/connection.js @@ -562,8 +562,8 @@ FTP.prototype.get = function(path, zcomp, cb) { if (!done) { done = true; ondone(); + return; } - return; } source._emit.apply(source, Array.prototype.slice.call(arguments)); }; @@ -614,8 +614,8 @@ FTP.prototype.get = function(path, zcomp, cb) { // just like a 150 if (code === 150 || code === 125) { started = true; - cb(undefined, source); sock.resume(); + cb(undefined, source); } else { lastreply = true; ondone();