fs readFfile code example
Example 1: javascript fs read
fs.readFile('/etc/passwd', (err, data) => {
if (err) throw err;
console.log(data);
});
Example 2: fs readfile encoding
fs.readFile('/etc/passwd', 'utf8', callback);
fs.readFile('/etc/passwd', (err, data) => {
if (err) throw err;
console.log(data);
});
fs.readFile('/etc/passwd', 'utf8', callback);