I\'m trying to read the content of test.txt(which is on the same folder of the Javascript source) and display it using this code:
test.txt
var fs = requi
The data variable contains a Buffer object. Convert it into ASCII encoding using the following syntax:
data
Buffer
data.toString('ascii', 0, data.length)
Asynchronously:
fs.readFile('test.txt', 'utf8', function (error, data) { if (error) throw error; console.log(data.toString()); });