application-config
Store your applications config where the operating system wants you to.
Last updated 6 years ago by linusu .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install application-config 
SYNC missed versions from official npm registry.

Node.js Application Config

Store your applications config where the operating system wants you to.

Installation

npm install --save application-config

Usage

var cfg = require('application-config')('App Name')

// Read the stored data
const data = await cfg.read()

// Write new config
await cfg.write({ n: 1337 })

// Trash the stored config
await cfg.trash()

API

applicationConfig(name)

Creates and return a new instance with the provided name.

cfg.read()

Read the stored configuration. Returns a Promise that settles with the data.

cfg.write(data)

Write new configuration. Returns a Promise.

cfg.trash()

Remove the stored configuration. Returns a Promise.

cfg.filePath

The path to the underlying file in which the configuration is stored.

Config location

Platform Location
OS X ~/Library/Application Support/<name>/config.json
Linux (XDG) $XDG_CONFIG_HOME/<name>/config.json
Linux (Legacy) ~/.config/<name>/config.json
Windows (> Vista) %LOCALAPPDATA%/<name>/config.json
Windows (XP, 2000) %USERPROFILE%/Local Settings/Application Data/<name>/config.json

License

MIT

Current Tags

  • 2.0.0                                ...           latest (6 years ago)

9 Versions

  • 2.0.0                                ...           6 years ago
  • 1.0.1                                ...           10 years ago
  • 1.0.0                                ...           10 years ago
  • 0.2.2                                ...           10 years ago
  • 0.2.1                                ...           10 years ago
  • 0.2.0                                ...           11 years ago
  • 0.1.2                                ...           11 years ago
  • 0.1.1                                ...           11 years ago
  • 0.1.0                                ...           11 years ago
Maintainers (2)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (3)
Dev Dependencies (3)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |