/Cakebase

Cakebase is an asynchronous fast json database for nodejs.

Primary LanguageJavaScriptMIT LicenseMIT



Cakebase

TRAVIS NPM GitHub issues NPM

Cakebase is an asynchronous fast json database that allows you to efficiently and easily edit, search or add objects. This project has been optimized and improved with some updates for 2 years now. Cakebase is currently only available in Nodejs.


Here are a few examples


Getting started

Use npm or yarn to install cakebase.

npm i cakebase

After the installation you can create a json file and start immediately.


Usage

Now you can import Cakebase to your project.

This is the easiest way to use Cakebase

const users = require('cakebase')("./users.json");

You can also use Cakebase with multiple json files

const table = require('cakebase');

const users = table("./users.json");
const log = table("./log.json");

add an object to the json file

await users.set({ id: 0, username: "John", email: "test@something.com" });

Retrieve for objects in the json file

const user = await users.get(obj => obj.username === "John");

update objects in the json file

await users.update(obj => obj.username === "John", { location: "Mars" });

remove objects in the json file

await users.remove(obj => obj.location === "earth");

Delete all objects in the json file

await users.clear();

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.


License

MIT