kvaluedb

1.0.1 • Public • Published

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>.

Readme

Keywords

Package Sidebar

Install

npm i kvaluedb

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

2.27 kB

Total Files

3

Last publish

Collaborators

  • simon-tiger