javascript - no returning value into console.log while using fs.read -
hello first of new node js,need in reading textfile "information.txt" , show values in console.log
this code: fs.readfilesync("information.txt", "utf-8", function (err, data) { if (err) { throw err; } var content = data; console.log(content); });
you have errors in code, working version:
var fs = require('fs'); var content = fs.readfilesync("themes", "utf-8"); console.log(content);
Comments
Post a Comment