
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.
mind is not a database / minimal database is lightweight asynchronous persistence layer for node.
mind was inspired by anti-db's idea that often, "you don't need a database, you need an in-memory object that saves itself to disk". However, I needed Windows support, evented API, and asynchronous loading, which, while simpler and more elegant in implementation, it forgoes.
npm install mind
process.exit();SIGINT, SIGHUP, and
SIGQUIT.var mind = require('mind');
var opts = { encoding: 'UTF-8', autosave: 60000 };
var dbm = new mind('path/to/db.json', opts);
dbm.on('open', function (e) {
console.log('[INFO] Opened db: ' + e.msg);
e.db['foo'] = 'bar';
e.db['baz'] = [1, 2, 3, 4];
});
dbm.on('close', function (e) {
console.log('[INFO] Closed db: ' + e.msg);
});
dbm.on('save', function (e) {
console.log('[INFO] Saved db: ' + e.msg);
});
dbm.on('error', function (e) {
console.error('[ERROR] Error in db: ' + e.msg);
console.error(e.error);
});
dbm.open();
var mind = require('mind');
mind.open('path/to/db.json', function (err, db, data) {
},
fn: String - Path writeable by the node processopts: Object - Options hash containing any of:
autosave: Number - ms between save operations (0 or negative disables
autosave). Default: 60000encoding: String - encoding used to read and write JSON file. Default:
'UTF-8'Create a new MindManager.
open on success.Open and read the database file, creating it if necessary.
save on success.Asynchronously save the database file to disk.
close on success.Synchronously closes the database file, persisting it to disk. This function
is synchronous to support non-autosaved use of mind, and is suitable for
calling within process.exit.
Synchronously start and stop the autosave process.
db: Object - Database object for which to get the associated MindManagerGet the MindManager for a particular database object.
fn: see new MindManageropts: see new MindManagercb: Callback used to respond to all events emitted by the created manager:
open: passes db as the new database objecterror: passes err as original error thrown, andopen, save, close, error: passes data as the complete event data objectHandles the creation of a manager object in a simplified single-callback
model. It is recommended to not bind your callback to any particular context
so you can access the manager instance at this. If you must, though,
the instance managing a particular db object can be accessed by:
mind.getManager(db)
event.db: The database object opened.
event.msg: Any message regarding the open operation.
Emitted on successful opening of a database.
event.msg: Any message regarding the close operation.
Emitted on successful closing of a database.
event.msg: Any message regarding the save operation.
Emitted on successful save of a database to persistent storage, either explicitly-initiated or autosave.
event.error: The originally-thrown error, if available.
event.msg: Any message regarding the error.
Emitted on any non-fatal caught error.
FAQs
mind is lightweight asynchronous persistence layer for node
We found that mind 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
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.