Created
August 16, 2015 07:15
-
-
Save mindspank/638dcaf662da1efebd11 to your computer and use it in GitHub Desktop.
serialize a qs app into json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var qsocks = require('qsocks'); | |
var serializeApp = require('serializeapp'); | |
var fs = require('fs-extra') | |
var Promise = require('promise'); | |
qsocks.Connect() | |
.then(function(global) { | |
return global.openDoc('Executive Dashboard.qvf') | |
}) | |
.then(function(app) { | |
return serializeApp(app); | |
}) | |
.then(function(data) { | |
return writeJson(data); | |
}) | |
.catch(function(error) { | |
console.log(error) | |
}).done(); | |
function writeJson(data) { | |
return new Promise(function(resolve, reject) { | |
fs.writeJson(data.properties.qTitle + '.json', data, function (err) { | |
if(err) { return reject(err); } | |
return resolve(); | |
}) | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment