Package Exports
- dotpref
 - dotpref/lib/index.js
 
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (dotpref) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
.pref
Perfect for CLI application user preferences
Out of the box ๐ฆโคต๏ธ easy application encrypted preferences ๐
Highlights
- No configuration needed โโ๏ธ
 - Everything is configurable โ โ๏ธ
 - Human-readable ๐ค or encrypted ๐
.filePathType:
readonly stringReadonly absolute path to the preference file stored on disk. This property will exist even if the preference file does not.
getDefaultCryptoOptions
defaultsType:
stateAn object specifying the default values of the preference state. If preferences are found, they will override the defaults in the state. If no preferences are found, defaults will be used โ state will not be written to disk upon creation. Default:
{}.nameType:
stringThe name of your project. This value will be used to build the
filePathof the preference file stored on disk. Default: thenameproperty of yourpackage.json.filenameType:
stringThe filename of the preference file stored on disk. Default:
config.prefdirPathType:
stringAbsolute path determining where the preferences should be stored on disk. Default:
<system config>/<name>where<system config>is the User's default system config path and<name>is thenameproperty configuration property;serializerType:
state => stringA function that specifies how the state should be serialized when written to disk. Default:
JSON.stringify.deserializerType:
string => stateThe reverse of
serializer. A function that specifies how the state should be deserialized when read from disk. Default:JSON.parse.encoderType:
string => stringA function that specifies how the state should be encrypted. Default:
getDefaultCrypto.encrypt.decoderType:
string => stringA function that specifies how the state should be decrypted. Default:
getDefaultCrypto.decrypt.setterType:
(state, key, value) => voidA function that takes the existing
state, thekey, and thevalueand returns a new state to be saved to disk. The state will be saved to disk if theequalityfunction returns false. Default:(state, key, value) => { ...state, [key]: value }.getterType:
(state, key) => valueReverse of setter. A function that takes the existing
stateand thekeyand returns the value. Default:(state, key) => state[key].equalityType:
boolean | (state, newState) => booleanDetermines the equality of the old state and the new state. This method is used to determine if the state has changed since the last write. If set to
truethe state will write to disk on everyset. When set tofalsethe state will never write to disk onsetand therefore must explicitly be written viawrite.Config Paths
For each OS below
<home>is calculated using NodeJS'os.homedir().- macOS: 
<home>/Library/Preferences/<name> - Windows: 
<home>/AppData/Roaming/<name>/Config - Linux: 
<home>/.config/<name>or$XDG_CONFIG_HOME/<name> 
 - macOS: