1const fs = require('fs');
2
3fs.readFile('/Users/joe/test.txt', 'utf8' , (err, data) => {
4 if (err) {
5 console.error(err);
6 return
7 }
8 console.log(data);
9});
1fs.readFile('filename', function read(err, data) {
2 if (err) {
3 throw err;
4 }
5 var content = data;
6
7 console.log(content);
8
9});