How can I change a specific line in a file using node js?

I want to change a specific line in a text file using node js with fs module.

Is there a more elegant way to load a file into an array?

Old file:

Line 1
Line 2
Line 3

      

New file:

Line 1
something new
Line 3

      

Thank you for your responses!

+3


source to share





All Articles