Permalink
Browse files

cross-platform simple file reading

  • Loading branch information...
kriszyp committed Jul 6, 2010
1 parent 0de931c commit ef60c3ae5374f0af2798ea2cfcf1b266184bb456
Showing with 6 additions and 2 deletions.
  1. +6 −2 lib/settings.js
View
@@ -1,6 +1,10 @@
-var fs = require("commonjs-utils/fs-promise");
+try{
+ var read = require("fs").readFileSync;
+}catch(e){
+ read = require("file").read;
+}
-var settings = JSON.parse(fs.read("local.json"));
+var settings = JSON.parse(read("local.json").toString("utf8"));
for(var i in settings){
exports[i] = settings[i];
}

0 comments on commit ef60c3a

Please sign in to comment.