1.0.1 • Published 7 years ago
cheesebox v1.0.1
Cheesebox
Simplified key-value storage powered by better-sqlite3.
Why Cheesebox?
- Simple key-value storage system
- Uses one of the fastest modules
- Has a very simple syntax
- Serializes any value into the database
Installation
npm i cheesebox
Documentation
Examples
const Cheesebox = require("cheesebox");
const db = Cheesebox.load("path/to/file.db");
// Every method is a synchronous method.
db.set("name", "lilian");
db.has("name"); // true
db.size; // 1
db.get("name"); // "lilian"
db.delete("name");
db.get("name"); // undefined
db.has("name"); // false.size
Returns: number
.clear() \
Clears all the entries in the database.
Returns: void
.delete(key) \
Deletes a specific entry.
| Parameter | Type |
|---|---|
| key | string |
Returns: void
.entries() \
Returns an array of all the entries.
[ ["name", "lilian"], ["some key", "some value"] ]
Returns: Array
.get(key) \
Returns the value of the entry.
| Parameter | Type |
|---|---|
| key | string |
Returns: *
.has(key) \
Checks whether the key exists.
| Parameter | Type |
|---|---|
| key | string |
Returns: boolean
.keys() \
Returns an array of all the keys.
Returns: Array
.set(key, value) \
Sets the specified value to a key.
| Parameter | Type |
|---|---|
| key | string |
| value | * |
Returns: void
.values() \
Returns an array of all the values.
Returns: Array