feature(rest) streamPack: add one-click folder download

This commit is contained in:
coderaiser 2015-07-06 07:50:54 -04:00
parent 6c8c128b38
commit 11d9e1fef2
2 changed files with 36 additions and 19 deletions

View file

@ -270,7 +270,7 @@ var CloudCmd, Util, DOM, CloudFunc, MenuIO;
}
function download() {
var TIME = 1000,
var TIME = 30 * 1000,
apiURL = CloudFunc.apiURL,
FS = CloudFunc.FS,
date = Date.now(),
@ -281,12 +281,14 @@ var CloudCmd, Util, DOM, CloudFunc, MenuIO;
selected = DOM.isSelected(file),
path = DOM.getCurrentPath(file),
id = DOM.load.getIdBySrc(path),
isDir = DOM.isCurrentIsDir(file),
dir = isDir ? '&&json' : '';
isDir = DOM.isCurrentIsDir(file);
CloudCmd.log('downloading file ' + path + '...');
path = apiURL + FS + path + '?download' + dir;
if (isDir)
path = apiURL + '/pack' + path + '.tar.gz';
else
path = apiURL + FS + path + '?download';
element = DOM.load({
id : id + '-' + date,