1.1.0 • Published 3 years ago

x73db v1.1.0

Weekly downloads
74
License
ISC
Repository
-
Last release
3 years ago

x73db

a simple json database

Useful Links: npm package page

####################################

to install it using npm

$ npm i x73db

###################################

import :

const x73db = require("x73db") 
//sorry, we not support ES6 right now

construction & creating db :

const db = new x73db("database/file Name"/* String, defult: (defult)*/
    /*Options (optional) */ 
    { /*Object*/
    debug, //Boolean, defult: (false)
    path, //database folder, String, defult: (Databases)
    })

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

how to use it :

//set & save some value
db.set("key" , "value")

//get some value
let value = db.get("key")//return "value"

//remove something
db.remove("key")

//load the full data as a Object
let data = db.load()//return an Object

//overwrite all the database file
db.overwrite(data)//Object

//clear all the data
db.clear()

//add an element to array
//or sum the numbers
//or add string
db.add("key","new value")

//dynamic use example
db.set(`${user.id}_password` , user.input.password)

###################################

some notes:

  • The database file extension is ".sdb" It's immutable
  • The way to save the data is JSON
  • x73db.devTools removed, becuse it's unusful for normal users
  • git repository & source code soon ... :")
  • this version is the way to online , soon ...

created By SaraX73 all rights reserved © 2020