Question: You have to read a large text file, replace some words in it, and write it back to a new file. You know that the memory on your target system is limited. What should you do?
- Use regular expressions directly on the file.
- Use Promises and async/await to offload the task to libuv.
- Copy the file into a database and perform the operations there.
- Use readline together with streams to read and transform and write the file contents line by line.
Answer: The correct answer of the above question is Option D:Use readline together with streams to read and transform and write the file contents line by line.