This is tinyjsondatabase. Its very simple database for your projects.
Function | Type | Description |
---|---|---|
setPath(path) |
string |
Sets database path. |
setLogging(bool) |
bool |
Enables or disables logging. |
set(data, value) |
string |
Sets data. |
get(data) |
string |
Gets data. |
delete(data) |
string |
Deletes data. |
check(data) |
string |
Checks data. |
const db = require("tinyjsondatabase");
// Set database path
db.setPath("database.json")
// Enable logging
db.setLogging(true)
// Set "Hello" to "World!"
db.set("Hello", "World!")
// Get "Hello" from database
db.get("Hello") // returns "World!"
// Delete "Hello" from database
db.delete("Hello")
// Check "Hello" from database
db.check("Hello") // returns false because we deleted it.
-- CREATING FILE
SUCCESS! File created automatically. || SUCCESS! File found.
-- IF LOGGING IS TRUE
SUCCESS! data set to value.
ERROR! data not found in database.
SUCCESS! data removed from database.