Suppose I have this structure:
Project
plugin
lib
controller.js
sockets.js
questions
questions1.txt
I want in read in my sockets.js the file questions1.txt so I do this:
Sockets.readFile=function(socket,data,callback){
fs.readFile(path.resolve( __dirname,"./questions/questions1.txt"), 'utf8', function (err,data) {
if (err) {
return console.log(err);
}
console.log(data);
});
};
The problem is that it prints me "no such file or directory". Anyone can help me?
via JoeB
No comments:
Post a Comment