qjson-db

1.0.2 • Public • Published

qjson-db: Dead simple JSON database


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.

/qjson-db/

    Package Sidebar

    Install

    npm i qjson-db

    Weekly Downloads

    6

    Version

    1.0.2

    License

    MIT

    Unpacked Size

    36.4 kB

    Total Files

    14

    Last publish

    Collaborators

    • tiagorangel2011