UNPKG

loganalyzer

Version:

A simple log analyzer supporting multiple filters and UI.

18 lines (16 loc) 452 B
const fs = require('fs'); /** FileReader reads a file and calls callback for content. */ FileReader = class { /** * @param {string} filePath Path to the file. * @param {!Function} onContentReady Callback for when content is ready. */ constructor(filePath, onContentReady) { fs.readFile(filePath, 'utf8', (err, data) => { if (err) { return console.log(colors.red(err)); } onContentReady(data); }); } };