
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
node-user-defaults
Advanced tools
Persistent data store for node apps.
The goal of this library is to provide a very straighforward way to write persistent data to disk. This can be useful when working with small amounts of data, like a simple configuration of an application or to store some preferences of a user. All data is stored in JSON format.
# Add the lib to your project and you are good to go.
$ yarn add node-user-defaults
# Not in a hurry? Use npm.
$ npm install --save node-user-defaults
import Store from 'node-user-defaults';
// OPTIONAL: Choose an output location for the JSON file.
// If this one is not provided, a random one will be created.
// You can always check the location via Store.getLocation().
Store.setLocation('~/.app-name');
// Storing variables is very easy and straighforward.
// You can store any type that is supported by JSON.
Store.write('darkTheme', true);
// Reading data is easy too. It's also possible to provide
// a default value in case the variable is not in the store.
const darkTheme = Store.read('darkTheme');
const name = Store.read('name', 'defaultValue');
// You can also write multiple variables at once by storing
// a plan JSON object. Easy huh?
Store.writeJson({ name: 'John' });
// It is also possible to overwrite the whole configuration.
// So all previously stored variables will be removed.
Store.writeJson({ name: 'John' }, true);
// Last but not least, you can query all the variables at once.
const data = Store.defaults();
$ git clone https://github.com/Jense5/node-user-defaults
$ cd node-user-defaults
$ yarn install
$ yarn test
This project is licensed under the MIT License - see the license file for details.
FAQs
User defaults for NodeJS
The npm package node-user-defaults receives a total of 1 weekly downloads. As such, node-user-defaults popularity was classified as not popular.
We found that node-user-defaults demonstrated a not healthy version release cadence and project activity because the last version was released 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.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.