Skip to content

Instantly share code, notes, and snippets.

@bmavity
Created February 17, 2011 17:54
Show Gist options
  • Save bmavity/832248 to your computer and use it in GitHub Desktop.
Save bmavity/832248 to your computer and use it in GitHub Desktop.
// readFile.js
// Load the built in file system module
var fs = require('fs');
// Read the config file (sychronously)
var rawConfig = fs.readFileSync(__dirname + '/config.json', 'utf8');
// Convert the file contents to JSON
var config = JSON.parse(rawConfig);
console.log(config.user); // brian
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment