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

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -