mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-20 01:47:35 +00:00
feature(rest) add unzip
This commit is contained in:
parent
83aa10660c
commit
41654e09d3
12 changed files with 66 additions and 4 deletions
|
|
@ -52,8 +52,12 @@
|
|||
Util.exec(p.callback, error);
|
||||
};
|
||||
|
||||
if (p.gzip) {
|
||||
gzip = zlib.createGzip();
|
||||
if (p.gzip || p.gunzip) {
|
||||
if (p.gzip)
|
||||
gzip = zlib.createGzip();
|
||||
else
|
||||
gzip = zlib.createGunzip();
|
||||
|
||||
read.on('error', onError);
|
||||
read = read.pipe(gzip);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -307,6 +307,24 @@
|
|||
|
||||
break;
|
||||
|
||||
case 'unzip':
|
||||
if (!Util.checkObjTrue(lFiles, ['from']))
|
||||
sendError(pParams, p.data);
|
||||
else
|
||||
pipe.create({
|
||||
from : lFiles.from,
|
||||
to : lFiles.to || Util.removeStrOneTime(lFiles.from, ['.zip', '.gzip']),
|
||||
gunzip : true,
|
||||
callback : function(error) {
|
||||
checkSendError(error, pParams, function() {
|
||||
var name = path.basename(lFiles.from);
|
||||
sendMsg(pParams, 'zip', name);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
break;
|
||||
|
||||
case 'config':
|
||||
var hash,
|
||||
passwd = lFiles && lFiles.password,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue