JSPM

  • Created
  • Published
  • Downloads 4
  • Score
    100M100P100Q56035F
  • License ISC

NoSql Json DB

Package Exports

  • @web_dev_guy/jdb-js
  • @web_dev_guy/jdb-js/JDB/JDB.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@web_dev_guy/jdb-js) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

WELCOME TO JDB.JS

this page will discuss how to operate with JDB.JS

What is JDB.JS?

JDB.JS is meant to be a NoSQL JSON datbase that people could use

Dependencies

  • fs

  • path

Installation

  • npm install @web_dev_guy/jdb-js

Linking to your Project

  • Import

    • import { JDB } from "@web_dev_guy/jdb-js";
  • Require

    • const { JDB } = require("@web_dev_guy/jdb-js");

JDB Class -

This is the class which contains all the functions that you can use the first parameter is the name of your file you will be preforming CRUD on

const { JDB } = require("./JDB/JDB.js") or require("@web_dev_guy/jdb-js");

const jdb = new JDB("jsonfile"); 

// links to "jsonfile.json" in the JDBF folder

now we will disscuss the functions in the JDB class

  • readData()-

    • this function reads the file that you have put as the parameter in the class's constructor.
  • writeData(data : String)-

    • this function writes the data into the JDBF (Json DataBase Files) , this WILL delete the rest of the contents in the file.
  • setData(key : String, value : String | Int)-

    • this is basically writeData, but it dosnt delete the existing contents and can only write new data once. It can also change the value of any key you put as the first param any time.
  • getData(key : String)-

    • this function will get the value of the key which has the same name as the key param.
  • addData(key : String, value: String | Int) -

    • this function appends data ("{key}" : "{value}") to the file instead of deleteing the already existing contents.
  • addBigData(code : String | Int)-

    • this is just add function but you could add lines of JSON code.
  • removeData(key : String)-

    • this function removes the key and its value from the JDBF code.
  • removeAllData(brackets : Boolean)-

    • removes all the code from the file, if brackets is true, then the brackets will also be delete, else the brackets will

JDB FileSystem -

there are also functions that you can use which are not inside of the JDB class, which are super useful.

CreateJDBF(name : String) -

  • This creates a new JDBF in the JDBF folder which has {} as the starting content.

DestroyJDBF(name : String) -

  • This destorys or deletes the JDBF from the JDBF folder.

IntegrateJDBF(oldf : String, newf : String)

  • This moves the data from the file named oldf to the file named newf.

DuplicateJDBF(file : String, name : String) -

  • This duplicates the file named file. then the duplicated file name is name.

HookJDBF(fileone : String, filetwo : String); -

  • This makes filetwo always have the contents of fileone.

Syntax

const {CreateJDBF, DeestroyJDBF, IntegrateJDBF} = require("./JDB/JDB.js") or require("@web_dev_guy/jdb-js");

CreateJDBF("example"); // creates new JDBF called example

// ...

IntegrateJDBF("example", "main"); // moves data from example.json to main.json

HookJDBF("main", "main2"); // main is now hooked to main

Duplicate("main", "main_dup"); // duplicated main and renamed the duplicate to main_dup

DestroyJDBF("example"); // destroys the JDBF called example