
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
Stower is a simple disk backed key/value store for node.
Why? because sometimes you just need to stow a few values, no database, no fuss. stower keeps your data in memory and writes it to disk as a readable JSON file in the background. It handles atomic saves, uses file locks to avoid conflicts, recovers from corrupt files, and stores everything in your systems cache folder (when no path provided).
npm install stower
var stower = require('stower');
// persist (optional JSON file path)
stower.persist('./stow.json');
// enable debugging (console logs)
stower.debug = true;
// store some data
stower.set('token', { id: '123', key: 'abc' });
// retrieve it
var token = stower.get('token');
// check it exists
if (stower.exists('token')) {
console.log('token exists');
}
// remove it
stower.remove('token');
// view all keys
console.log(stower.keys());
// view all values
console.log(stower.values());
// get the JSON file name and path
console.log(stower.filename);
// clear everything
stower.clear();
| Property | Description |
|---|---|
filename | Returns filename used so store data on disk |
debug | Get/set debug status (enables console logs) |
| Method | Description |
|---|---|
get(key) | Retrieves a value by key, returns null if the key doesn't exist |
set(key, value) | Stores a value and schedules it to be saved to disk |
remove(key) | Deletes a key from the store and schedules the update to disk |
exists(key, val) | Checks if a key exists and optionally if it matches a given value using deep equality |
keys() | Returns an array of all stored keys |
values() | Returns an array of all stored values |
clear() | Deletes all stored data and schedules a save to disk |
persist(filename) | Loads previously saved values from disk and auto saves changes (optional filename) |
Note: if persist() is not called, values only exist in memory.
As always, pull requests are welcomed - but please ensure you provide a test where necesssary.
You can run the tests using npm test
If you find this useful please star the repo, it helps us prioritise Open Source work.
For change-log, check releases.
MIT License © Orca Scan - a barcode app with simple barcode tracking APIs.
FAQs
Simple disk backed key/value store for node
The npm package stower receives a total of 144 weekly downloads. As such, stower popularity was classified as not popular.
We found that stower 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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.