Reputation: 1
why below code is giving buffered output even though "utf-8" is the default encoding?
fs.readFile('includes/India2011.csv',function (err, data) {
if (err) throw err;
console.log(data);
});
Upvotes: 0
Views: 783
Reputation: 8699
From the documentation:
If no encoding is specified, then the raw buffer is returned.
You have to specify utf-8 encoding like this:
fs.readFile('includes/India2011.csv', 'utf-8', function (err, data) {
if (err) throw err;
console.log(data);
});
Upvotes: 2