1.1.5 • Published 11 months ago

urlocaldb v1.1.5

Weekly downloads
-
License
ISC
Repository
-
Last release
11 months ago

urlocaldb

A simple JSON database for Node.js.

Support Server : here

Useful Links: npm package page

Installation

Install urlocaldb using npm:

$ npm install urlocaldb

Usage

Import the package:

const urlocaldb = require("urlocaldb");

Create a new instance of the database:

const db = new urlocaldb("database/file Name"/* String, default: "default" */,
  /* Options (optional) */
  {
    debug: false, // Boolean, default: false
    path: "Databases" // Database folder, String, default: "Databases"
  }
);

Examples

const db = new urlocaldb("myDB");
const db2 = new urlocaldb("secDB", { debug: true });
const db3 = new urlocaldb("startingDB", { debug: false, path: "DB" });
const db4 = new urlocaldb("passwords", { path: "accounts" });

API

  • db.set(key, value): Sets the value for the given key.
  • db.get(key): Retrieves the value for the given key.
  • db.remove(key): Removes the entry for the given key.
  • db.load(): Loads the full data as an object.
  • db.overwrite(data): Overwrites the entire database file with the provided data (object).
  • db.clear(): Clears all the data in the database.
  • db.add(key, value): Adds an element to an array, sums the numbers, or concatenates a string.
  • Dynamic use example: db.set(${user.id}_password, user.input.password).

Notes

  • The database file extension is ".sdb", and it is immutable.
  • The data is saved in JSON format.
  • The urlocaldb.devTools feature has been removed as it is not useful for normal users.
  • Git repository and source code will be available soon.

Created by Bilal Chentouf. All rights reserved © 2023.

1.1.5

11 months ago

1.1.4

11 months ago

1.1.3

11 months ago

1.1.2

11 months ago

1.1.1

11 months ago

1.1.0

11 months ago