From the docs:
If no encoding is specified, then the raw buffer is returned.
Which might explain the <Buffer ...>
. Specify a valid encoding, for example utf-8
, as your second parameter after the filename. Such as,
fs.readFile("test.txt", "utf8", function(err, data) {...});