0.0.6 • Published 2 years ago
catliondb v0.0.6
CatlionDB
Written by CatLion (Alexa)
CatlionDB is a customizable JSON database engine made to be easy to use. CatlionDB Features at a glance:
- Internel DB option
- Ability to destroy databases
- Ability to change database file path
- Colored console text :o
Documentation:
Code Sample
const CatlionDB = require("CatLionDB")
const DB = new CatlionDB.JSONDB("./Database.json");
DB.value = {"Key1":"Value1"}
DB.value["ExampleArray"] = [{"Name":"Alexa"}, {"Favorite Color":"Pink"}]
DB.write().then(Result => {
console.log(Result)
}).catch(Error => {
console.log(Error)
})
Functions
Initalize Database
new CatlionDB.JSONDB(file,[options]);
file
Path where the database JSON file is located or will be created.options
Json object containing options listed below.
Set database Value
#value = [Json Object]
Json Object
The data to be written to database. This is a regular JSON Object so you can use all the supported methods of JSON manipulation on it.
Write to database
#write()
- Retrurns a promise which resolves on successful write and rejects on error. Details are always returned in the resolve/reject.
Destroy Database
#destroy()
- Retrurns a promise which resolves on successful destruction and rejects on error. Details are always returned in the resolve/reject. You can create the database again with
#setFile()
Set database file
#setFile(path, [options])
- Retrurns a promise which resolves on successful set and rejects on error. Details are always returned in the resolve/reject.
file
Path where the database JSON file is located or will be created.options
This option isINTERNAL_DB
. Weather to create the database internally or not Setting this value will set the value the same way it would be set when you first ilitalize the database. You will need to unset it to turn it off.
##Please report any bugs on github. Thanks. ###Suggestions are also apritiated.