
Research
Security News
Lazarus Strikes npm Again with New Wave of Malicious Packages
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
electron-settings
Advanced tools
User settings manager for Electron, adapted from Atom/config.
Key | Type | Description | Default |
---|---|---|---|
shouldSave | boolean | Whether we should save changes to disk. | true |
set(keyPath, value[, options])
Sets the value of a configuration setting at the given key-path.
Parameter | Type | Description | Required | Default |
---|---|---|---|---|
keyPath | string | The key-path. | ✓ | |
value | * | The value to set the given key-path. | ✓ | |
options | Object | ElectronSettings options. | See options |
let ElectronSettings = require('electron-settings');
let settings = new ElectronSettings();
settings.set('foo', 'bar');
console.log(settings.get());
// => { foo: 'bar' }
let ElectronSettings = require('electron-settings');
let settings = new ElectronSettings();
settings.set('foo.bar.baz', 'qux');
console.log(settings.get());
// => { foo: { bar: { baz: 'qux' } } }
let ElectronSettings = require('electron-settings');
let settings = new ElectronSettings();
settings.set('foo', {
snap: {
crackle: 'pop'
}
});
console.log(settings.get());
// => { foo: { snap: { crackle: 'pop' } } }
let ElectronSettings = require('electron-settings');
let settings = new ElectronSettings();
// This will overwrite any pre-existing settings.
settings.set({
foo: 'bar'
});
console.log(settings.get());
// => { foo: 'bar' }
get(keyPath):Object
Gets the value of a configuration setting at the given key-path. Returns an Object
.
Parameter | Type | Description | Required | Default |
---|---|---|---|---|
keyPath | string | The key-path. |
let ElectronSettings = require('electron-settings');
let settings = new ElectronSettings();
settings.set('foo', 'bar');
console.log(settings.get('foo'));
// => 'bar'
let ElectronSettings = require('electron-settings');
let settings = new ElectronSettings();
settings.set('foo.bar.baz', 'qux');
console.log(settings.get('foo.bar'));
// => { baz: 'qux' }
let ElectronSettings = require('electron-settings');
let settings = new ElectronSettings();
settings.set('foo.bar.baz', 'qux');
console.log(settings.get());
// => { foo: { bar: { baz: 'qux' } } }
unset(keyPath[, options])
Unsets a configuration setting at the given key-path.
Parameter | Type | Description | Required | Default |
---|---|---|---|---|
keyPath | string | The key-path. | ✓ | |
options | Object | ElectronSettings options. | See options |
let ElectronSettings = require('electron-settings');
let settings = new ElectronSettings();
settings.set('foo', 'bar');
console.log(settings.get());
// => { foo: 'bar' }
settings.unset('foo');
console.log(settings.get());
// => {}
let ElectronSettings = require('electron-settings');
let settings = new ElectronSettings();
settings.set('foo.bar.baz', 'qux');
console.log(settings.get());
// => { foo: { bar: { baz: 'qux' } } }
settings.unset('foo.bar');
console.log(settings.get());
// => { foo: null }
getUserConfigPath():string
Gets the string path to the config file being used. Returns a string
.
let ElectronSettings = require('electron-settings');
let settings = new ElectronSettings();
console.log(settings.getUserConfigPath());
// => /Users/Nathan/Library/Application Support/Electron/config/settings.json
observe
method to watch when a particular key-path has changed.ISC
FAQs
A simple and robust settings management library for Electron.
The npm package electron-settings receives a total of 4,881 weekly downloads. As such, electron-settings popularity was classified as popular.
We found that electron-settings demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.
Security News
Opengrep continues building momentum with the alpha release of its Playground tool, demonstrating the project's rapid evolution just two months after its initial launch.