Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/s-a/user-appdata
https://github.com/s-a/user-appdata
Last synced: about 5 hours ago
JSON representation
- Host: GitHub
- URL: https://github.com/s-a/user-appdata
- Owner: s-a
- License: other
- Created: 2016-04-06T17:43:19.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-04-07T18:55:26.000Z (over 8 years ago)
- Last Synced: 2024-08-09T10:17:38.045Z (3 months ago)
- Language: JavaScript
- Size: 15.6 KB
- Stars: 9
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# user-appdata
[![NPM Version](http://img.shields.io/npm/v/user-appdata.svg)](https://www.npmjs.org/package/user-appdata)
[![Build Status](https://travis-ci.org/s-a/user-appdata.svg)](https://travis-ci.org/s-a/user-appdata)
[![Coverage Status](https://coveralls.io/repos/github/s-a/user-appdata/badge.svg?branch=master)](https://coveralls.io/github/s-a/user-appdata?branch=master)
[![Codacy Badge](https://api.codacy.com/project/badge/grade/b90f442f62ae44a4b95a07cbdd69fb85)](https://www.codacy.com/app/stephanahlf/user-appdata)
[![Dependency Status](https://david-dm.org/s-a/user-appdata.svg)](https://david-dm.org/s-a/user-appdata)
[![devDependency Status](https://david-dm.org/s-a/user-appdata/dev-status.svg)](https://david-dm.org/s-a/user-appdata#info=devDependencies)
[![NPM Downloads](https://img.shields.io/npm/dm/user-appdata.svg)](https://www.npmjs.org/package/user-appdata)
[![Massachusetts Institute of Technology (MIT)](https://s-a.github.io/license/img/mit.svg)](/LICENSE.md#mit)
[![Donate](http://s-a.github.io/donate/donate.svg)](http://s-a.github.io/donate/)Load and save application data platform independent without additional configuration based on the current users system ```APP_DATA``` folder.
## Contructor parms
- appname (not optional) - A unique app name. Best one is the ```name``` property from your ```package.json```.
- filename (optional) - Default ```config.json```.
- defaultSettings (optional).## Methods
- ```load()```
- ```save()```
- ```uninstall()```
- ```setConfigFilename(filename /* string */)```### Example
```javascript
var Config = require("user-appdata");
var config = new Config({appname : "myApp", defaultSettings : {"foo" : "bar"}});
console.log(config);
```### Yields on Microsoft Windows:
```javascript
{
settings: {
foo: 'bar'
},
appName: 'myApp',
dataFolder: 'C:\\Users\\Stephan\\AppData\\Roaming\\myApp',
filename: 'C:\\Users\\Stephan\\AppData\\Roaming\\myApp\\config.json'
}
```