mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 02:35:49 +00:00
feature(rest) flop.cp -> copymitter
This commit is contained in:
parent
1103ea7e4d
commit
83c8ea7e06
2 changed files with 14 additions and 5 deletions
|
|
@ -28,6 +28,7 @@
|
|||
pipe = require('pipe-io'),
|
||||
ponse = require('ponse'),
|
||||
rendy = require('rendy'),
|
||||
copymitter = require('copymitter'),
|
||||
|
||||
Modules = require(DIR_JSON + 'modules'),
|
||||
|
||||
|
|
@ -164,7 +165,7 @@
|
|||
* @param pParams {command, method, body, requrest, response}
|
||||
*/
|
||||
function onPUT(name, body, callback) {
|
||||
var cmd, files, data, from, to, error;
|
||||
var cmd, files, data, from, to, error, msg, wasError, emitter;
|
||||
|
||||
Util.check(arguments, ['name', 'body', 'callback']);
|
||||
|
||||
|
|
@ -227,10 +228,17 @@
|
|||
files.from = mellow.pathToWin(files.from);
|
||||
files.to = mellow.pathToWin(files.to);
|
||||
|
||||
data = files.names.slice();
|
||||
copyFiles(files, flop.copy, function(error) {
|
||||
var msg = formatMsg('copy', data);
|
||||
|
||||
msg = formatMsg('copy', files.names);
|
||||
|
||||
emitter = copymitter(files.from, files.to, files.names);
|
||||
|
||||
emitter.on('end', function() {
|
||||
if (!wasError)
|
||||
callback(null, msg);
|
||||
});
|
||||
|
||||
emitter.on('error', function(error) {
|
||||
wasError = true;
|
||||
callback(error, msg);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
"dependencies": {
|
||||
"ashify": "~1.0.0",
|
||||
"console-io": "~2.1.0",
|
||||
"copymitter": "~1.4.1",
|
||||
"edward": "~1.1.0",
|
||||
"execon": "~1.1.0",
|
||||
"express": "~4.11.0",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue