How can the fs module handle reading very large files without loading the entire file into memory?

  • By using the fs.readFile() method
  • By using the fs.read() method
  • By using the fs.createReadStream() method
  • By using the fs.loadLargeFile() method
To handle reading very large files without loading the entire file into memory, you can use the fs.createReadStream() method. This method reads the file in small chunks, which allows you to process large files efficiently without consuming excessive memory. The other options do not provide a built-in mechanism for handling large files in this manner.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *