darkdb
v2.2.1-pre
Published
Database module for json
Downloads
18
Maintainers
Readme
DarkDB
Description
Database module for json
Install
npm i darkdb --save
Example
Setup
const DarkDB = require("darkdb")
const dbOptions = {
"name": "darkdb",
"separator": ".",
"autoFile": true,
"jsonSpaces":4,
"language":"en" // tr, en or ru
};
const db = new DarkDB(dbOptions);
Set - Get - Delete
db.set("x.y.z", "test"); // {"x": {"y": {"z": "test"}}}
db.get("x"); // {"y": {"z": "test"}}
db.delete("x.y.z"); // true
Has Check - Get All - Delete All
db.has("x"); // true
db.all(); // {"x": {"y": {}}}
db.deleteAll(); // true
Push - Unpush
db.push("x", "hello") // ["hello"]
db.push("x", "world") // ["hello", "world"]
db.unpush("x", "hello") // ["world"]
Add - Remove
db.add("x",10)//10
db.remove("x",1)//9