Menu BAR

FEEL FREE TO ASK ANY PROGRAM and please mention any error if you find it

14 Nov 2022

Node JS program to read a text file

 4) Program to read a file from node.js

const fs = require ('fs');

fs.readFile('./test.txt','utf8', (err, data) => {
    if (err) {console.error(err); }

    console.log ("Data is: "+data);
});

No comments:

Post a Comment