| Ex No: 6 | NON-BLOCKING CODE IN NODE.JS |
|---|---|
| Aim: | To demonstrate node.js non-blocking code by reading a text file. |
| Procedure | |
| Step1: Install Node Package Manager (npm) in the system. | |
| Step2: Initialize Node.js using "npm init -y" in the terminal. | |
| Step3: Create a file “readFile.js” to demonstrate non-blocking code in node js. | |
| Step4: Create a text file “myPage.txt” which is read by the "readFile.js". | |
| Step5: Run the code using "node readFile.js". | |
| Source Code | |
readFile.js
|
|
| Result: | Thus node.js non-blocking code to read a text file is implemented. |