Ex No: 7 | BLOCKING CODE IN NODE.JS |
---|---|
Aim: | To demonstrate node.js 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 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 blocking code to read a text file is implemented. |