user-appdata

0.1.2 • Public • Published

user-appdata

NPM Version Build Status Coverage Status Codacy Badge Dependency Status devDependency Status NPM Downloads Massachusetts Institute of Technology (MIT) 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

var Config = require("app-userdata");
var config = new Config({appname : "myApp", defaultSettings : {"foo" : "bar"}});
console.log(config);

Yields on Microsoft Windows:

{
    settings: {
        foo: 'bar'
    },
    appName: 'myApp',
    dataFolder: 'C:\\Users\\Stephan\\AppData\\Roaming\\myApp',
    filename: 'C:\\Users\\Stephan\\AppData\\Roaming\\myApp\\config.json' 
}

Package Sidebar

Install

npm i user-appdata

Weekly Downloads

40

Version

0.1.2

License

MIT

Last publish

Collaborators

  • s-a