Band write it back to a new file. You know that the memory on your target system is limited. What should you do?
CUse regular expressions directly on the file
DUse Promises and async/await to offload the task to libuv
Copy the file into a database and perform the operations there
Đúng
FUse readline together with streams to read and transform and write the file contents line by line ro NEE a She ote pole eniet Dee ut lau
Giải thích chi tiết
Khi bạn cần đọc một tệp văn bản lớn nhưng hệ thống mục tiêu của bạn có bộ nhớ hạn chế, bạn nên chọn cách thức xử lý tệp đó một cách hiệu quả. Một trong những cách tốt nhất là sao chép tệp vào cơ sở dữ liệu và thực hiện các hoạt động xử lý dữ liệu trong đó. Điều này cho phép bạn tận dụng sức mạnh của cơ sở dữ liệu trong việc xử lý dữ liệu lớn mà không cần phải lưu trữ toàn bộ tệp vào bộ nhớ. Ngoài ra, cách thức này cũng giúp bạn dễ dàng quản lý và bảo trì dữ liệu, cũng như thực hiện các hoạt động xử lý dữ liệu một cách linh hoạt và hiệu quả.