0.0.1 • Published 1 year ago
ashkia.db v0.0.1
Ashkia.DB
Ashkia.db is a fast, tiny, simple JSON database package with backup system.
🧭 How To Use
npm install ashkia.db
⛳ Examples
const db = require("ashkia.db");
db.set("test", "123"); //Output: 123
db.push("test123", "a"); //Output: ["a"]
db.push("test123", "b"); //Output: ["a","b"]
db.add("number", 3); //Output: 3
db.add("number", 50); //Output: 53
db.subtract("number", 10); //Output: 43
db.all(); //Output: [{ ID:'test',data:'123'},{ID:'test123',data:['a','b']},{ID:'number',data:43}]
db.delete("number"); //Output: true
db.deleteAll(); //Output: true
db.get("test"); //Output: ["a","b"]
db.get("test123"); //Output: 123
db.fetch("test"); //Output: 123
db.check("test"); //Output: true
db.has("test"); //Output: true
Import from Another Database Package/JSON File
//from package
const db = require("ashkia.db");
const otherdb = require("exampledb");
db.importFromDB(otherdb); //Output: true
//from JSON file
const db = require("ashkia.db");
db.importFromJSONFile("./database.json"); //Output: true
Backing Up the Database File
const db = require("ashkia.db");
db.createBackup("./backup.json"); //Automatically creates the backup file
db.loadBackup("./backup.json");
db.loadBackup("./backup.json", true); //true means the database file will be cleaned before the backup is loaded
0.0.1
1 year ago