support batch getFileSize calls

This commit is contained in:
ansuz
2017-04-21 14:51:00 +02:00
parent 1af621bfe5
commit c51073f211
2 changed files with 54 additions and 1 deletions

View File

@@ -93,6 +93,21 @@ define([
});
};
// take a list of channels and return a dictionary of their sizes
exp.getMultipleFileSize = function (files, cb) {
if (!Array.isArray(files)) {
return window.setTimeout(function () {
cb('[TypeError] pin expects an array');
});
}
rpc.send('GET_MULTIPLE_FILE_SIZE', files, function (e, res) {
if (e) { return void cb(e); }
if (typeof(res) !== 'object') {
return void cb('INVALID_RESPONSE');
}
})
};
// get the combined size of all channels (in bytes) for all the
// channels which the server has pinned for your publicKey
exp.getFileListSize = function (cb) {