0
我在Nodejs上使用Plotly時出現了一些錯誤,你能幫助我嗎?在Nodejs上可憐 - 「套接字掛斷並讀ECONNRESET」
我寫一個演示從splotly api生成圖像,每20秒,服務器將創建一個圖表圖像。有些圖片是好的,但再扔犯錯的圖像:
我的代碼:
setInterval(function() {
plotly.getImage(figure, imgOpts, function(error, imageStream) {
if (error) return console.log(error);
var time = new Date();
console.log("1--" + new Date());
var fileStream = fs.createWriteStream(time + '.png');
console.log("2--" + new Date());
imageStream.pipe(fileStream);
// setTimeout(function(){
// console.log("3--"+new Date());
// //createPdfkit(time);
// },10000);
// imageStream.on('end',function(){
//
// });
});
}, 20000);