juicydb
v1.0.1
Published
JSON Database.
Downloads
2
Readme
JuicyDB
A new JSON database that's mainly useful for one-guild bots.
Useful Links
Setup
First, we need to install the package. Do so by writing the following command into your terminal.
$ npm install juicydb
Before anything, you need to create a json file named juicydb.json
wherever you want it to be.
You can then start using the package. Below, I will show you an example on how to use JuicyDB.
// Require the package & define db
const JuicyDB = require('juicydb');
const db = new JuicyDB('./juicydb.json');
// Set the value test to hello_world
db.set('test', 'hello_world')
// Expected result: hello_world
console.log(db.get('test'));
// Expected result: { 'test': 'hello_world' }
console.log(db.JSON());
Usage
Set a value on a key
db.set('key', 'value');
Get the value from a key
db.get('key');
Check if a key exists
db.has('key');
Delete a key
db.delete('key');
Delete all keys
db.deleteAll();
Sync to disk
db.sync();
Get all keys & values in a JSON response
db.JSON();