wynddb
v2.0.2
Published
Super simple async JSON based Database that saves to a file.
Downloads
4
Readme
WyndDB
Are you tired of all those complex database systems like SQL and MongoDB that all have confusing syntax? Do you want a simple DB that is easy to use, yet powerful for small projects? Then this no-dependency library is the solution for you! It uses filesystem to write & read JSON to a file called wdb
, and puts all data into separate modules with user specified names.
This too complex? Here's an example of WyndDB in use:
//Import the module's Connector class
import { Connector } from "wynddb";
//Create or Access the db
let connection = new Connector({
name: 'users',
file: './users.json'
}).then(async db => {
await db.set('user1', {
id: 1,
name: 'test_user',
verified: false
});
await db.update('user1', { verified: true });
await db.get('user1') // returns { id: 1, name: "test_user", verified: true }
});
Documentation:
classes: Connector
- The database connection object (doesn't hold the data)
<Connector>.connect(name)
- Connect/create a db
<Connector>.get(key)
- If there is a key, it will return the keys value, if not, it will return the db.
<Connector>.set(key, value)
- add a key value pair to the db
<Connector>.delete(key)
- If there is a key, it will delete the keys value, if not, it will delete the db.
<Connector>.filter(filter function)
- filter stuff from a db