Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
simple-json-db
Advanced tools
A simple, no-frills, JSON storage engine for Node.JS.
npm install --save simple-json-db
var JSONdb = require('simple-json-db');
var db = new JSONdb('/path/to/your/database.json', { options });
Key | Value type | Description | Default value |
---|---|---|---|
asyncWrite | Boolean | Enables the storage to be asynchronously written to disk. | false (synchronous behaviour) |
syncOnWrite | Boolean | Makes the storage be written to disk after every modification. | true |
db.set('key', 'value');
The key
parameter must be a string, value
can be whatever kind of object can be stored in JSON format. JSON.stringify()
is your friend!
db.get('key');
The key
parameter must be a string. If the key exhists its value is returned, if it doesn't the function returns undefined
.
db.has('key');
The key
parameter must be a string. If the key exhists true
is returned, if it doesn't the function returns false
.
db.delete('key');
The key
parameter must be a string. The function returns as per the delete operator if the key exhists, else it returns undefined
.
db.sync();
This function writes the JSON storage object to the file path specified as the parameter of the main constructor. Consult the Options section for usage details; on default options there is no need to manually invoke it.
db.JSON();
This will return a copy of the internal JSON storage object, for you to tinker with and loop over.
db.JSON({ data });
Giving a parameter to the JSON
function makes the object passed replace the internal one. Be careful, as there's no way to recover the old object if the changes have already been written to disk.
Run npm test
to start the combined Mocha & Chai testing suite.
FAQs
A simple, no-frills, JSON storage engine for Node.JS
The npm package simple-json-db receives a total of 1,436 weekly downloads. As such, simple-json-db popularity was classified as popular.
We found that simple-json-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
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.