An open API service indexing awesome lists of open source software.

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

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