Explain the difference between readFile and createReadStream in Node js ?

devquora
devquora

Posted On: Feb 22, 2018

 

  • readFile load the whole file which you had marked to read whereas createReadStream reads the complete file in the parts of the size you have declared.
  • The client will receive the data faster in the case of createReadStream in contrast with readFile.
  • In readFile, a file will first completely read by memory and then transfers to a client but in later option, a file will be read by memory in a part which is sent to clients and the process continue until all the parts finish.

    Related Questions

    Please Login or Register to leave a response.

    Related Questions

    Node JS Interview Questions

    What is Node js ?

    Node Js is one of the most popular and powerful server technologies today. It allows you built the entire website only..

    Node JS Interview Questions

    Explain CLI in Node.js?

    CLI stands for Command Line Interface. It is a utility or program on your computer where users type commands to perform..

    Node JS Interview Questions

    In which Language Node Js is written ?

    Node js is written in C, C++,JavaScript.It uses Google’s open source V8 Javascript Engine to convert Javascript code..