mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
feature(rest) copy: add progress
This commit is contained in:
parent
60971d7cce
commit
03d0c8c05c
1 changed files with 10 additions and 0 deletions
|
|
@ -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);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue