command-line-config

Quick and dirty loading/saving of JSON files.

Quick and dirty loading/saving of JSON files.

var settings_access = require('command-line-config')

var settings = settings_access.load('./some_file.json')
settings.dumb = false
settings_access.save(settings, './some_file.json')

If you don't specify a path to load, the module assumes the file was passed in via the command-line, like so: node your-script.js config-file.json

var settings = settings_access.load()
settings.wat = "WHERE DID YOU COME FROM"
settings_access.save(settings)

In order to for load() to return synchronously, it calls fs.existsSync(). For this reason, the module should only be useful in command-line scripts.

Written for ISoft Data Systems, licensed WTFPL.