New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ramlitedb

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ramlitedb - npm Package Compare versions

Comparing version 0.1.7 to 0.1.8

2

package.json
{
"name": "ramlitedb",
"version": "0.1.7",
"version": "0.1.8",
"description": "NoSQL Database for node.js with all data loaded in ram and backup in json file",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -16,3 +16,80 @@ # ramliteDB

## Examples
Here is a list of way to set and get the data
D
// Load the library
var RamliteDB = require('ramlitedb');
// instanciate the database
var rlDB = new RamliteDB({
backupFile: './dataBase.json'
});
// wait for database to be loaded
rlDB.on('loaded', () => {
// set an numerical value
rlDB.set('version', 1.5);
rlDB.get('version'); // (numeric) 1.5
// set a string value
rlDB.set('cake.name', 'Chocolator');
rlDB.get('cake.name'); // (string) "Chocolator"
rlDB.set('cake.sugar', '10 kg');
console.log(rlDB.get('cake.sugar')); // (string) "10 kg"
// set a boolean value
rlDB.set('cake.good', true);
console.log(rlDB.get('cake.good')); // (bool) true
// set an array
rlDB.set('cake.ingredients', [
"egg",
"sugar",
"chocolate",
"floor"
]);
console.log(rlDB.get('cake.ingredients')); // (array) [egg, ...]
// get a specific element from an array
console.log(rlDB.get('cake.ingredients.2')); // (string) "chocolate"
// set an object
rlDB.set('cake.description', {
title: "my cake",
author: "me the cooker"
});
console.log(rlDB.get('cake.description')); // (object) {title: ...}
// get element inside and object
console.log(rlDB.get('cake.description.title')); // (string) "my cake"
// get element anywhere in the database
console.log(rlDB.get('cake')); // (object) {"version":1.5, ...}
})
```
In the end you should have dataBase.json like this
```dataBase.json
{
"version": 1.5,
"cake": {
"name": "Chocolator",
"sugar": "10 kg",
"good": true,
"ingredients": [
"egg",
"sugar",
"chocolate",
"floor"
],
"description": {
"title": "my cake",
"author": "me the cooker"
}
}
}
```
## Have fun folks ;)
and give me sendBack
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc