Socket
Socket
Sign inDemoInstall

best.db

Package Overview
Dependencies
0
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    best.db

It is a easy and quick storage unit that relies on `objects` to store data in **JSON** format


Version published
Maintainers
1
Install size
37.6 kB
Created

Readme

Source

Discord server NPM version NPM downloads

What is best.db ?

  • It is a easy and quick storage

Installation

  • You need to install the package on your project
npm i best.db

Updates

  • Version (1.0.7, 1.0.8, 1.1.1, 1.1.4, 1.1.5) => Fix Some Errors
  • Version (1.0.9) => Add Fetch
  • Version (1.1.2) => Change (.) To (..)
  • Version (1.1.3) => Fix Some Errors && Preventing mistakes from occurring

How To Use

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

db.set(`key`, value); // To Set a Data
db.set(`key`, "This is Value"); // => true
db.set(`key..name`, "test"); // => key = { name: "test" };
db.set(`key..data`, "Hello World"); // => key = { name: "test", data: "Hello World" };
db.set(`key..number`, 0); // => key = { name: "test", data: "Hello World", number: 0 };
db.set(`key..array`, []); // => key = { name: "test", data: "Hello World", number: 0, array: [] };

db.get('key'); // To Get The Data By Key
db.get('key'); // => This is Value
db.get(`key..name`); // => test;

db.fetch('key'); // To Get The Data By Key
db.fetch('key'); // => This is Value
db.fetch(`key..name`); // => test;

db.delete('key'); // To Delete Data By Key
db.delete('key'); // => true
db.delete(`key..data`); // => key = { name: "test", number: 0, array: [] };

db.has('key'); // To Get True Or False
db.has('key'); // => true
db.has(`key..name`); // => true
db.has(`key..data`); // => false

db.add('key', value); // To Add a Number
db.add('key', 5); // => key = 5;
db.add(`key..number`, 1); // => key = { name: "test", number: 1, array: [] };

db.subtract('key', value); // To Subtract a Number
db.subtract('key', 5); // key = 0
db.subtract('key..number', 1);  // => key = { name: "test", number: 0, array: [] };

db.push('key', element); // To Push Element To Data
db.push('key', "Push"); // key = ["Push"]
db.push('key..array', "Push 1"); // => key = { name: "test", number: 0, array: ["Push 1"] };

db.pull('key', element); // To Pull Element From Data
db.pull('key', "Push"); // key = []
db.pull('key..array', "Push 1"); // => key = { name: "test", number: 0, array: [] };

db.all(); // To Get All Data
// Exmaple => [ { ID: `test`, data: `Hello World` } ]

db.backup("Filename"); // To Make a Backup File
db.reset(); // To Delete All Data

Developer

Keywords

FAQs

Last updated on 04 May 2024

Did you know?

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc