1.0.2 • Published 2 years ago

qjson-db v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

A fork of nmaggioni/Simple-JSONdb, this is a dead simple JSON database for your web app. Check out the demo at qjsondb-demo.glitch.me

Install: npm i qjson-db

Tests tests Known Vulnerabilities

Usage

Start by creating your database:

const qjson = require("qjson-db");
const db = new qjson("/path/to/your/storage.json");

Set a key

db.set('key', 'value');

This adds a record to the database. The 2nd parameter can be a JSON object.

Get a key

db.get('key');

This will get a key from the database and return it.

Delete a key

db.delete('key');

This deletes a key from the database.

Get database's contents

db.JSON();

This will return a copy of the JSON database.

Replace database

db.JSON({ data });

Giving a parameter to the JSON function makes the object passed replace the database's contents.