'How do I read a file and change every line in it?

I need to read a multiline txt file and do some manipulations with each line. I'm trying to use readline but I can't figure out how to use the lines it reads. Here I use the most standard readline code:

const readline = require ('readline')
const fs = require ('fs')

const rl = readline.createInterface({
    input: fs.createReadStream('price.txt'),
    
})

rl.on('line', function(line){
    
    console.log(line)
})


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source