// Tested with Node 16 const Convert = require('ansi-to-html'); const fs = require('fs'); const convert = new Convert(); function renderHTML(body) { return ` ANSI text → HTML ${body} `; } const inputFile = process.argv[2]; if (!inputFile) { console.error( 'ERROR: No input filed specified.\n\nUsage:\n\tnode convert ', ); process.exit(1); } const ansiText = fs.readFileSync('typedoc-errors.log', 'utf-8'); const lines = ansiText.split('\n'); const convertedLines = lines.map((l) => convert.toHtml(l)).join('
'); const html = renderHTML(convertedLines); fs.writeFileSync('out.html', html);