https://github.com/s-a/user-appdata
https://github.com/s-a/user-appdata
Last synced: 2 months 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 (about 9 years ago)
- Default Branch: master
- Last Pushed: 2016-04-07T18:55:26.000Z (about 9 years ago)
- Last Synced: 2025-03-29T19:34:30.846Z (3 months ago)
- Language: JavaScript
- Size: 15.6 KB
- Stars: 9
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# user-appdata
[](https://www.npmjs.org/package/user-appdata)
[](https://travis-ci.org/s-a/user-appdata)
[](https://coveralls.io/github/s-a/user-appdata?branch=master)
[](https://www.codacy.com/app/stephanahlf/user-appdata)
[](https://david-dm.org/s-a/user-appdata)
[](https://david-dm.org/s-a/user-appdata#info=devDependencies)
[](https://www.npmjs.org/package/user-appdata)
[](/LICENSE.md#mit)
[](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'
}
```