Right now I am on an XP box, but this is the same thing on Vista.
I am using node.js v 0.6.14
the following does not work:
var fs = require("fs");
fs.readFile(filename, "utf8", function(err, data) { ... } );
I do NOT get anything in err, but data contains the following:
'{' is not recognized as an internal or external command, operable program or batch file.
If I remove the encoding parameter, then I do get the raw buffer data back. Is this a known issue on the Windows port of node or am I completely missing something? If it is a known issue, are there any good workarounds?
What kind of file is it? I created a text file named "text.txt" with the contents of "this is a text file".
I don't have an XP VM handy, but this worked fine for me in node 0.6.9:
var fs = require("fs");
fs.readFile("text.txt","utf8",function(err,data){
console.log("err: " + err);
console.log(data);
});
with output of:
err: null
this is a text file