file asyncronously 
                  
                  
                  in this program
                  
                  
                  if file reading operation starts and the method give the control back to the main execution so that the remaingn code can execute 
                  
                  
                  cool
                  
                  
                  now as said before it is single threaded than how the multi execution will take place 
                  
                  
                  i.e 1) reading the file
                  
                  
                      2) exectuing the next statements 
                  
                  
                      as node is just a single threaded 
                  
                  
                  
                  
                  
                      also what if the very next execution needs the upper execution' result (which is async operation) 
                  
                  
                      for this particular case. there would be no any advantage for aysnc right ?
                  
                  
                
node makes an asynchronous call to read the file, remembers to call a callback when reading is done, and continues to execute the current stack. When node is idle, it waits for the os to report it's done reading the file, and then it calls the callback there would be no any advantage for aysnc right ? there is. While the async operation is not done yet, node can run other code, such as processing other requests
Обсуждают сегодня