
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
declarative-db
Advanced tools
An easy-to-use declarative json-based database for Node
npm install declarative-db
const path = require('path');
const declare = require('declarative-db');
// Declare json-based database
declare({
filename: path.join(__dirname, './db.json'),
}).then(db => {
// Use it as you would normally use an object (or array)
db.users = [{
username: 'loarca',
}];
// It will automatically save to disk asynchronously when appropriate
});
Since it's Promise based you can also use async-await
const path = require('path');
const declare = require('declarative-db');
(async () => {
// Declare json-based database
let db = await declare({
filename: path.join(__dirname, './db.json'),
});
// Use it as you would normally use an object (or array)
db.users = [{
username: 'loarca',
}];
// It will automatically save to disk asynchronously when appropriate
})();
You should declare() only once per file
and share declared objects/arrays across all modules,
as every declared object/array is... exactly that... an object/array in memory
that automatically saves to disk when appropriate
{
filename: path.join(__dirname, './db.json'),
initialState: {},
compression: 0,
}
File to store data
When no database file exists initialState is used,
it may be an object or array
Compression level ranging from 0 to 9
Level 0 outputs database to readable json
{
"users": [
{
"username": "loarca"
}
]
}
Levels from 1 to 9 match DEFLATE compression levels
filename option is not present, manage database in memoryFAQs
An easy-to-use declarative json-based database for Node
We found that declarative-db 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
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.