From 03d0c8c05c1917a7d5b5f52d6517960a53774dc4 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 17 Feb 2015 10:49:42 -0500 Subject: [PATCH] feature(rest) copy: add progress --- lib/server/rest.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/server/rest.js b/lib/server/rest.js index e61ce7aa..9d0b9d9f 100644 --- a/lib/server/rest.js +++ b/lib/server/rest.js @@ -287,6 +287,7 @@ function copy(from, to, names, fn) { var error, + tmpl = '\r copy {{ from }} {{ to }} {{ count }}%', cp = copymitter(from, to, names); cp.on('error', function(e) { @@ -294,7 +295,16 @@ cp.abort(); }); + cp.on('progress', function(count) { + process.stdout.write(rendy(tmpl, { + to: to, + from: from, + count: count + })); + }); + cp.on('end', function() { + process.stdout.write('\n'); fn(error); }); }