What's the best way to overwrite a line in a large (2MB+) text file using node.js?
My current method involves
- copying the entire file into a buffer.
- Spliting the buffer into an array by the new line character (
\n). - Overwriting the line by using the buffer index.
- Then overwriting the file with the buffer after join with
\n.