Last active
June 11, 2019 09:47
-
-
Save anthonycoffey/2e0586561dafc0a43a4a88c97ab2f061 to your computer and use it in GitHub Desktop.
Highcharts Export Server Node Module
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
const exporter = require('highcharts-export-server'); | |
const chartExport = { | |
initPool: function (){ | |
exporter.initPool({ // experiment with different values here to optimize performance | |
maxWorkers: 10, | |
initialWorkers: 1, | |
workLimit: 25, | |
timeoutThreshold: 2000, | |
queueSize: 3, | |
listenToProcessExits: 0 // set to 0 to skip attaching process.exit handlers | |
}) | |
return false; | |
}, | |
killPool: function(){ | |
exporter.killPool(); | |
return false; | |
}, | |
export: function(exportSettings){ | |
return new Promise((resolve, reject) => { | |
exporter.export(exportSettings, function(err, res){ | |
if(err){ | |
console.log(err); | |
return reject(err); | |
} | |
const data = res.data; | |
return resolve(data); | |
}) | |
}) | |
} | |
} | |
module.exports = chartExport; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment