willyb321

Untitled

Sep 24th, 2016
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.89 KB | None | 0 0
  1. function readLineMemory() {
  2. var html = '';
  3. loadFile = dialog.showOpenDialog({properties: ['openFile']})
  4. const lr = new LineByLineReader(loadFile[0]);
  5.  
  6. lr.on('error', err => {
  7. return console.log(err);
  8. });
  9.  
  10. lr.on('line', line => {
  11. const lineParse = JSON.parse(line);
  12. JSONParsed.push(lineParse);
  13. const htmlTabled = tableify(lineParse) + '<hr>';
  14. html = html + tableify(lineParse);
  15. html = 'data:text/html,' + encodeURIComponent(html);
  16. })
  17. // fs.appendFile(`${process.resourcesPath}/index2.html`, htmlTabled, err => {
  18. // if (err) {
  19. // return console.log(err);
  20. // }
  21. // });
  22. // });
  23. // fs.appendFile(`${process.resourcesPath}/index2.html`, '<script src="https://use.fontawesome.com/a39359b6f9.js"></script><style>body {padding: 0; margin: 0; } body {background-color: #313943; color: #bbc8d8; font-family: \'Lato\'; font-size: 22px; font-weight: 500; line-height: 36px; margin-bottom: 36px; text-align: center; } header {position: absolute; width: 500px; height: 250px; top: 50%; left: 50%; margin-top: -125px; margin-left: -250px; text-align: center; } header h1 {font-size: 60px; font-weight: 100; margin: 0; padding: 0; } #grad {background: -webkit-linear-gradient(left, #5A3F37 , #2C7744); /* For Safari 5.1 to 6.0 */ background: -o-linear-gradient(right, #5A3F37 , #2C7744); /* For Opera 11.1 to 12.0 */ background: -moz-linear-gradient(right,#5A3F37 , #2C7744); /* For Firefox 3.6 to 15 */ background: linear-gradient(to right, #5A3F37 , #2C7744); /* Standard syntax */ } hr {color: red; }</style><link href="https://fonts.googleapis.com/css?family=Lato:400,400italic,700" rel="stylesheet" type="text/css">', err => {
  24. // if (err) {
  25. // return console.log(err);
  26. // }
  27. // });
  28. lr.on('end', () => {
  29. console.log('done!');
  30. console.log('The file was saved!');
  31. win.loadURL(html);
  32. // win.loadURL(`file://${process.resourcesPath}/index2.html`);
  33. });
  34. return win;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment