1.0.1 • Published 5 years ago

cheesebox v1.0.1

Weekly downloads
3
License
ISC
Repository
github
Last release
5 years ago

Cheesebox

Simplified key-value storage powered by better-sqlite3.

Why Cheesebox?

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.

ParameterType
keystring

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.

ParameterType
keystring

Returns: *


.has(key) \ Checks whether the key exists.

ParameterType
keystring

Returns: boolean


.keys() \ Returns an array of all the keys.

Returns: Array


.set(key, value) \ Sets the specified value to a key.

ParameterType
keystring
value*

Returns: void


.values() \ Returns an array of all the values.

Returns: Array


1.0.1

5 years ago

1.0.0

5 years ago