mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-18 17:05:17 +00:00
refactor(rest) main.sendResponse -> sendMsg
This commit is contained in:
parent
4bd98be868
commit
7031a8478e
1 changed files with 10 additions and 6 deletions
|
|
@ -139,7 +139,7 @@
|
|||
if (lQuery === 'dir')
|
||||
fs.mkdir(p.name, function(pError) {
|
||||
if (!pError)
|
||||
main.sendResponse(pParams, 'make dir: ok("' + p.name + '")');
|
||||
sendMsg(pParams, 'make dir', p.name);
|
||||
else
|
||||
main.sendError(pParams, pError);
|
||||
});
|
||||
|
|
@ -164,7 +164,7 @@
|
|||
main.sendError(pParams, pError);
|
||||
else {
|
||||
lName = path.basename(lName);
|
||||
main.sendResponse(pParams, pMsg + ': ok("' + p.name +'")');
|
||||
sendMsg(pParams, 'ok', p.name);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
@ -175,7 +175,7 @@
|
|||
if (lQuery === 'dir')
|
||||
fs.rmdir(p.name, function(pError){
|
||||
if (!pError)
|
||||
main.sendResponse(pParams, 'delete: ok("' + p.name + '")');
|
||||
sendMsg(pParams, 'delete', p.name);
|
||||
else
|
||||
main.sendError(pParams, pError);
|
||||
});
|
||||
|
|
@ -209,7 +209,7 @@
|
|||
fs.unlink(d.name, log);
|
||||
|
||||
if (lAssync === n && !p.error)
|
||||
main.sendResponse(pParams, 'delete: ok("' + pBody + '")');
|
||||
sendMsg(pParams, 'delete', pBody);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -225,7 +225,7 @@
|
|||
}else
|
||||
fs.unlink(p.name, function(pError) {
|
||||
if (!pError)
|
||||
main.sendResponse(pParams, 'delete: ok("' + p.name + '")');
|
||||
sendMsg(pParams, 'delete', p.name);
|
||||
else
|
||||
main.sendError(pParams, pError);
|
||||
});
|
||||
|
|
@ -341,7 +341,7 @@
|
|||
lReadStream.on('error', lError);
|
||||
|
||||
lReadStream.on('end', function(){
|
||||
main.sendResponse(pParams, 'copy: ok("' + l.to + '")');
|
||||
sendMsg(pParams, 'copy', l.to);
|
||||
});
|
||||
|
||||
lReadStream.pipe(lWriteStream);
|
||||
|
|
@ -409,4 +409,8 @@
|
|||
}
|
||||
}
|
||||
|
||||
function sendMsg(pParams, pMsg, pName) {
|
||||
main.sendResponse(pParams, pMsg + ': ok("' + pName + '")');
|
||||
}
|
||||
|
||||
})();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue