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
there is. While the async operation is not done yet, node can run other code, such as processing other requests but what if there is only one statement after this async operation and that statement needs the output of the previous aysnc call ? in this case there would be no advantage of using callbacks and async operations right ?
Обсуждают сегодня