Package Exports
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
fspath
Installation
npm install @web_dev_guy/JDB-JS- NOTE : the npm module dosnt currently work
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");
const jdb = new JDB("jsonfile");
// links to "jsonfile.json" in the JDBF foldernow 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
datainto the JDBF (Json DataBase Files) , this WILL delete the rest of the contents in the file.
- this function writes the
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
keyparam.
- this function will get the value of the key which has the same name as the
addData(key : String, value: String | Int)-- this function appends data (
"{key}" : "{value}") to the file instead of deleteing the already existing contents.
- this function appends data (
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
oldfto the file namednewf.
DuplicateJDBF(file : String, name : String) -
- This duplicates the file named
file. then the duplicated file name isname.
HookJDBF(fileone : String, filetwo : String); -
- This makes
filetwoalways have the contents offileone.
Syntax
const {CreateJDBF, DeestroyJDBF, IntegrateJDBF} = require("./JDB/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