import readline from 'readline'
import fs from 'fs'
fs.writeFileSync('./output.txt', '', {flag: 'w'})
const readInterface = readline.createInterface(
fs.createReadStream('./folder/list.html'),process.stdout
);
readInterface.on('line', function(line) {
// console.log(line);
let str: string = line;
if (str.includes('gameListRowItemName ellipsis')) {
let index: number = str.indexOf('">');
let endIndex: number = str.indexOf('</')
if (index > 0 && endIndex > 0) {
let pi = str.substring(index + 2, endIndex);
// console.log(pi);
fs.writeFileSync('./output.txt', pi + '\n', {flag: 'a'})
}
}
});