1.0.1 • Published 4 years ago

kvaluedb v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

A super-simple key-value store. This means it's equivalent to a JS Object: every entry in the database has a name (the key) and a value (the value).

Import

const database = require("kvaluedb");

Usage

Making the database

No need to do anything!

That's right, importing the module automatically a file called database.db for the database! If such a file is already there, then the contents of that file are assumed to be the contents of the database.

Getting the database

database.list() returns the entire database.

If you want to get just a single entry of the database, use database.get(<key>) to get the value of a specific entry. If the entry in question is not in the database, it will throw an error.

Setting an entry of the database

database.set(<key>, <value>) adds an entry with key <key> and value <value>. If an entry with key <key> is already in the database, it will overwrite it's value.

Deleting an entry of the database

database.delete(<key>) deletes the entry with key <key>. If the entry in question is not in the database, it will throw an error.

Checking if an entry exists in the database

database.has(<key>) checks if an entry exists with key <key>.