Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including command-line-config with all npm packages installed. Try it out:

var commandLineConfig = require("command-line-config")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

command-line-config v1.4.1

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, './some_file.json')

All paths are interpreted relative to the current working directory.

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"

Which command-line argument will be interpreted as a file to be opened? The first one to resolve to an actual file, of course!

All file-system interactions are done synchronously, which means you most likely only want to be interacting with it when your app launches/terminates (which is the most likely use case anyway).

Written for ISoft Data Systems, licensed WTFPL.

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free