zacron.db
A JSON Database Module
npm install zacron.db
- EN | zacron.db is easy to use, useful, new and faster Json based database module.
Releases (v5.1.0)
Set Data With Using APIs.
If you want to save a data from API, there is an easy method for this.
Use ".setFromAPI()" for save data from API.
Example:
zdb.setFromAPI("https://api.example.com/data", "test_data", { headers: {...} });
Auto Open Database File
Database file is now opening automaticly! You must only enter file name.
Definition
There are 3 different definitions:
const { Database } = require("zacron.db");
const zdb = new Database("<DatabaseFileName>")
import { Database } from "zacron.db";
const zdb = new Database("<DatabaseFileName>")
Note:
Database File Name Is Optional. If Filename Is Not Specified, Default Filename Is Will Be "database.json". If You Specify A File Name, You Must Open File Manually.
Examples
For Set A Data To Database:
const { Database } = require("zacron.db");
const zdb = new Database("<DatabaseFileName>")
zdb.set("data", "value")
For Fetch A Data From Database:
const { Database } = require("zacron.db");
const zdb = new Database("<DatabaseFileName>")
console.log(zdb.fetch("data_name"))
Methods
Set A Data:
set("data", "value")
save("data", "value")
setFromAPI("reqURL", "data_name", {})
Fetch A Data:
get("data")
fetch("data")
Math:
add("data", number) - Addition
subtract("data", number) - Subtraction
multiply("data", number) - Multiplication
divide("data", number) - Division
Delete A Data - All Datas - Backup Database:
delete("data")
all(limit) - Limit Is Optional.
backup("backup_file_name")
Delete All Datas - Delete Database File:
deleteAll()
clear()
destroy()
Type of Value of Data Name - Push Value To Array - Delete Value From Array:
type("data")
push("data", "value")
pull("data", "value")