https://github.com/linusu/node-application-config
🔧 Store config for your node applications
https://github.com/linusu/node-application-config
Last synced: about 1 year ago
JSON representation
🔧 Store config for your node applications
- Host: GitHub
- URL: https://github.com/linusu/node-application-config
- Owner: LinusU
- License: mit
- Created: 2014-12-28T10:54:40.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2023-01-06T14:17:08.000Z (over 3 years ago)
- Last Synced: 2025-04-12T20:02:46.236Z (about 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 24.4 KB
- Stars: 44
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# Node.js Application Config
Store your applications config where the operating system wants you to.
## Installation
```sh
npm install --save application-config
```
## Usage
```js
import createApplicationConfig from 'application-config'
const cfg = createApplicationConfig('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
### `createApplicationConfig(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//config.json`
Linux (XDG) | `$XDG_CONFIG_HOME//config.json`
Linux (Legacy) | `~/.config//config.json`
Windows (> Vista) | `%LOCALAPPDATA%//config.json`
Windows (XP, 2000) | `%USERPROFILE%/Local Settings/Application Data//config.json`
## License
MIT