So, I have this code:
function readLineMemory() {
loadFile = dialog.showOpenDialog({properties: ['openFile']});
console.log(loadFile);
var lr = new LineByLineReader(loadFile[0]);
lr.on('error', err => {
return console.log(err);
});
lr.on('line', function (line) { // called every line
// var html = '';
const lineParse = JSON.parse(line);
JSONParsed.push(lineParse);
let htmlTabled = tableify(lineParse) + '<hr>';
html = html + htmlTabled;
});
lr.on('end', function () { // called when file is read fully
html = 'data:text/html,' + html;
})} return html
However, when I try to return the html value, it just returns undefined. I have been banging my head on the wall for a while with this, and I just cannot figure out what I am doing wrong. As far as I'm aware, the code isn't async. The html value should actually be a string of html code that I am using in another function.