Skip to content

Instantly share code, notes, and snippets.

@mindspank
Last active March 24, 2016 04:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mindspank/867cb5c1f951060d0435 to your computer and use it in GitHub Desktop.
Save mindspank/867cb5c1f951060d0435 to your computer and use it in GitHub Desktop.
ObjectDump
var qsocks = require('qsocks');
var Promise = require('bluebird');
var fs = require('fs-extra');
var config = {
isSecure: true,
host: '<HOSTNAME>',
port: 4747,
headers: {
'X-Qlik-User': 'UserDirectory=Internal;UserId=sa_repository'
},
cert: fs.readFileSync('./client.pem'),
key: fs.readFileSync('./client_key.pem'),
rejectUnauthorized: false
};
var main = qsocks.Connect(config);
main.then(function(global) {
return global.getDocList().then(function(doclist) {
return doclist.map(function(d) {
return {id: d.qDocId, name: d.qTitle};
})
})
})
.then(function(list) {
return Promise.map(list, function(d, i) {
var c = config;
c.appname = d.id;
return qsocks.Connect(c).then(function(global) {
return global.openDoc(d.id, '', '', '', true);
})
.then(function(app) {
return app.getAllInfos().then(function(obj) {
return obj;
});
})
.then(function(objectlist) {
return list[i].objects = objectlist
})
}, { concurrency: 10} )
.then(function() {
return list
})
})
.then(function(list) {
return fs.writeJsonSync('./objects.json', {apps: list});
})
.catch(function(err) {
console.log(err);
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment