I am trying to read the contents of a properties file in node. this is my call:
fs.readFile(\"server/config.properties\", {encoding: \'utf8\'}, function(err, dat
Depending on the version of Node you're running, the argument may be just the encoding
:
fs.readFile("server/config.properties", 'utf8', function(err, data ) {
console.log( data );
});
The 2nd argument changed to options
with v0.10:
- FS
readFile()
,writeFile()
,appendFile()
and their Sync counterparts now take anoptions
object (but the old API, anencoding
string, is still supported)
For former documentation: