mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
refactor(copy) rm error
This commit is contained in:
parent
cb1fb02d86
commit
01fa5ffec8
1 changed files with 9 additions and 16 deletions
|
|
@ -292,22 +292,15 @@ function operation(op, from, to, names, fn) {
|
|||
}
|
||||
|
||||
function copy(from, to, names, fn) {
|
||||
let error;
|
||||
const cp = copymitter(from, to, names);
|
||||
|
||||
cp.on('error', e => {
|
||||
error = e;
|
||||
cp.abort();
|
||||
});
|
||||
|
||||
cp.on('progress', (count) => {
|
||||
process.stdout.write(`\r copy ${from} ${to} ${count}%`);
|
||||
});
|
||||
|
||||
cp.on('end', () => {
|
||||
process.stdout.write('\n');
|
||||
fn(error);
|
||||
});
|
||||
copymitter(from, to, names)
|
||||
.on('error', fn)
|
||||
.on('progress', (count) => {
|
||||
process.stdout.write(`\r copy ${from} ${to} ${count}%`);
|
||||
})
|
||||
.on('end', () => {
|
||||
process.stdout.write('\n');
|
||||
fn();
|
||||
});
|
||||
}
|
||||
|
||||
function copyFiles(files, processFunc, callback) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue