node package manager

Introducing npm Enterprise add-ons. Integrate third-party dev tools into npm…

preferences

Manage CLI application encrypted preferences.

Preferences

Node.JS Module for handling encrypted user preferences.

Designed for CLI applications.

npm install --save preferences
var Preferences = require("preferences");
 
// Init preference file with an unique identifier and an optional default data 
var prefs = new Preferences('com.your.app.identifier',{
  account: {
    username: 'MrRobot',
    password: 'fsociety'
  },
  test: {
    cycles: 1
  }
});
 
// Preferences can be accessed directly 
prefs.test.cycles++;
 
console.log(prefs.account);

Preferences are automatically saved on disk before process exit.

Encryption uses your private ssh key if founded, otherwise it will automatically use an identifier dependant generated password.

You can override the default key path in the options:

var prefs = new Preferences('com.foo.bar',{}, {
  key: '~/certs/my-custom-key.pem'
});

MIT. Copyright (c) 2015 Caffeina.