Socket
Book a DemoInstallSign in
Socket

all.db

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

all.db

JSON Database

0.3.2
latest
Source
npmnpm
Version published
Weekly downloads
5.3K
58622.22%
Maintainers
1
Weekly downloads
 
Created
Source

all.db

If you found a bug contact me on Discord.

Set
import { Database } from "all.db";
const db = new Database({ dataPath: "./data.json" });

// Sets a data in the database
db.set("nonametxt.test", "all.db");

Output:

{
  "nonametxt":{
    "test":"all.db"
  }
}
Get
import { Database } from "all.db";
const db = new Database({ dataPath: "./data.json" });

//Fetches you the data
db.get("nonametxt");
db.fetch("nonametxt");

Output:

"all.db"
Delete
import { Database } from "all.db";
const db = new Database({ dataPath: "./data.json" });

//Deletes data
db.delete("nonametxt.test");
db.remove("nonametxt.test");

Output:

{}
Add
import { Database } from "all.db";
const db = new Database({ dataPath: "./data.json" });

//If the data is a number, it adds a certain amount to data
db.add("nonametxt.number", 1);

Output:

data + 1
Subtract
import { Database } from "all.db";
const db = new Database({ dataPath: "./data.json" });

//If the data is a number, it subtracts a certain amount from it
db.subtract("nonametxt.number", 1);

Output:

data - 1
Push
import { Database } from "all.db";
const db = new Database({ dataPath: "./data.json" });
db.push("nonametxt.array", { name: "NoNametxt" });

//Pushes an element to an array
db.push("nonametxt.array", { name: "NoNametxt" }, true); //If data is not an array It will convert the data to an array

Output:

{
  "nonametxt":{
    "array":[
      {
        "name":"NoNametxt"
      }
    ]
  }
}
Pull
import { Database } from "all.db";
const db = new Database({ dataPath: "./data.json" });

//Specify the object you want to delete.
db.pull("nonametxt.array", (value) => {
  try{
    return value[1].name == "NoNametxt";
  }catch(error){

  }
});

Output:

{
  "nonametxt":{
    "array":[]
  }
}
Data Exists
import { Database } from "all.db";
const db = new Database({ dataPath: "./data.json" });

//Checks the data is available
db.exists("nonametxt.test");
db.has("nonametxt.test");

Output:

true or false
Typeof
import { Database } from "all.db";
const db = new Database({ dataPath: "./data.json" });

//Shows the type of data
db.typeof("nonametxt.typeof"); // true or false (checks the string)

//Compares the type of data with the type you typed
db.typeof("nonametxt.typeof", "number");

Output:

true or false
Math
import { Database } from "all.db";
const db = new Database({ dataPath: "./data.json" });

//If the data is a number, applies math operations to data.
db.math("nonametxt", "*", 10);

Output:

data * 10
Find
import { Database } from "all.db";
const db = new Database({ dataPath: "./data.json" });

//If you have entered data, it will find and show you.
db.find("Database", true); //Searches without checking case

Database:

{
  "string": "DATABASE",
  "otherString": "NoNametxt",
  "object": {
    "db": "database"
  },
  "array": ["database"]
}

Output:

[
  [ "string", "DATABASE" ],
  [ "object.db", "database" ],
  [ "array.0", "database" ]
]
Filter
import { Database } from "all.db";
const db = new Database({ dataPath: "./data.json" });

//If you have entered data, it will filter and show you.
db.filter(([key, value]) => {
    try {
      return value.includes("DataBase");
    } catch (error){

    };
});

Database:

{
  "string": "DataBase",
  "otherString": "NoNametxt",
  "object": {
    "db": "DataBase"
  },
  "array": [ "DataBase" ]
}

Output:

{ 
  "string": "DataBase",
  "array": [ "DataBase" ] 
}
Get All
import { Database } from "all.db";
const db = new Database({ dataPath: "./data.json" });

db.getAll(); //Returns JSON Data

db.getAll().save(path); //Saves the data to the specified path

Output:

{ All Data }

Version 0.3.2 *

+ Fix push

Thx for use all.db.

Keywords

Simple

FAQs

Package last updated on 05 Apr 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.