db.magma

a lightweight and quick database

Usage no npm install needed!

<script type="module">
  import dbMagma from 'https://cdn.skypack.dev/db.magma';
</script>

README

support

Discord Server

db.magma

Beginner Friendly.
Data doesn't gets restarted through project restart.
LightWeight, Quick, Works on any versions of node JS.
Uses LocalStorage to save files.
User can change storage path.
and more.....

Example

const db = require("db.magma");

// Adding value of the ID inside the db file
db.add({ name: "DataBase File Name", id: "Data ID", add: Number })
db.add({ name: "DataBase File Name", parent: "Data ID Parent", id: "Data ID", add: Number})
// This creates a DB file if it doesn't exist or replaces the value if it already exists

// Subtracting value of the ID inside the db file
db.subtract({ name: "DataBase File Name", id: "Data ID",/*[sub | subtract]*/ sub: 100 })
db.subtract({ name: "DataBase File Name", parent: "Data ID Parent", id: "Data ID", subtract: Number})
// You can either use sub or subtract

// Setting the value of the ID inside the db file
db.set({ name: "DataBase File Name", id: "Data ID", set: "value" })
db.set({ name: "DataBase File Name", parent: "Data ID Parent", id: "Data ID", set: Any})
// Replacing the ID of the current ID inside the db file
db.replaceID({ name: "DataBase File Name", currentID: "Data ID", newID: "New Data ID" })
db.replaceID({ name: "DataBase File Name", parent: "Data ID Parent", currentID: "Data ID", newID: "New Data ID" })
// This won't reset the value of the DB ID

// Removing an ID from the DB file
db.removeID({ name: "DataBase File Name", id: "Data ID" })
db.removeID({ name: "DataBase File Name", parent: "Data ID Parent", id: "Data ID" })
// This removes the DB ID along with its value

// Removing a DB file
db.removeDB({ name: "DataBase File Name" })
// This deletes the DB file, means every ID and its value will be removed

// Fetching the value of the ID inside the DB file
db.get({ name: "DataBase File Name", id: "Data ID" })
db.get({ name: "DataBase File Name", parent: "Data ID Parent", id: "Data ID" }) //returns you the value of the DB->ID

db.get({ name: "DataBase File Name", IDincludes: "Data ID includes" })
db.get({ name: "DataBase File Name", parent: "Data ID Parent", IDincludes: "Data ID includes" }) // returns you an array of IDs and it's value of which ID includes "IDincludes"

// To change the storage path
db.setStoragePath(__dirname + "./database path")

// This resets the database, means all the database files will be removed and the storage path will be set to default

db.resetDB()

Updates

• Bug fixes.
• Parent id making is available, use "parent" key in add, subtract, set, replaceID, removeID or removeParent function.

Upcoming Updates

• Multi-player will be available.