feature(rest) add unzip

This commit is contained in:
coderaiser 2014-03-25 04:05:13 -04:00
parent 83aa10660c
commit 41654e09d3
12 changed files with 66 additions and 4 deletions

View file

@ -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);
}

View file

@ -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,