@imehmetgenc/jsondb
v0.0.1
Published
This module allows you to create an easy-to-use and instantly modifiable local database in JSON format.
Downloads
3
Maintainers
Readme
$ npm install @imehmetgenc/jsondb
const MegaDB = require('@imehmetgenc/jsondb');
import MegaDB from '@imehmetgenc/jsondb';
const newDb = new MegaDB("test"); // Create database src: /database/test.json
/*
const newDb = new MegaDB(); // Create database src: /database/database.json
const newDb = new MegaDB({ "name": "test", "folder": "database", "noBlankData": true, "readable": true }); // Create database src: /database/test.json
*/
newDb.set("database", "test"); // output: true, data: { "database" : "test" }
newDb.set("array", [1]); // output: true, data: { "array" : [1] }
newDb.push("array", 2); // output: true, data: { "array" : [1, 2] }
newDb.set("number", 1); // output: true, data: { "number" : 1 }
newDb.add("number", 2); // output: true, data: { "number" : 3 }
newDb.all(); // output: { "database" : "test", "array" : [1, 2], "number" : 3 }
newDb.deleteAll(); // output: true, data: {}